%widgets {

    * {
        -gtk-outline-radius: 2px;
        margin: 0;
    }

    label:disabled { color: transparentize($fg_color, 0.65); }
    label, image { color: inherit; }

    separator {
        background-color: rgba(0,0,0,0.25);
        min-width: 1px;
        min-height: 1px;
    }

    // Entries
    entry {
        @include entry(selection,disabled);

        caret-color: $fg_color;

        image {
            color: $fg_color;
            &.left { padding-left: 0; padding-right: 3px; }
            &.right { padding-right: 0; padding-left: 3px; }
        }
    }

    // Buttons
    button {
        @include widget_button(disabled,label);

        separator { margin: 4px 1px; }
    }

    stackswitcher button.text-button { min-width: 70px; }

    // Linked Widgets
    @include widget_linked(entry,button);

    // ComboBoxes
    combobox {
        arrow {
          -gtk-icon-source: -gtk-icontheme('pan-down-symbolic');
          min-height: 16px;
          min-width: 16px;
        }
        &.linked {
            button:nth-child(2) {
                &:dir(ltr) { @extend %linked:last-child; }
                &:dir(rtl) { @extend %linked:first-child; }
            }
        }
    }

    // Spinbuttons
    spinbutton {
        color: $fg_color;
        caret-color: currentColor;

        &:not(.vertical) {
            button, entry { @extend %linked; }
        }

        &:dir(ltr) entry,
        &:dir(rtl) button.up { border-radius: $roundness 0 0 $roundness; }
    }

    // Progressbars
    @include widget_progressbar(progressbar, progress, trough);

    // Scale
    scale {
        min-height: 10px;
        min-width: 10px;
        padding: 5px;

        value, marks { color: gtkalpha(currentColor, 0.7); }

        &:disabled { opacity: 0.4; }

        // slider sizing
        @if $variant == 'default' {
            slider {
                min-width: 6px;
                min-height: 6px;
                margin: 0;
            }
            &:hover slider {
                min-width: 14px;
                min-height: 14px;
                margin: -4px;
            }
        }
        @else {
            slider {
                min-width: 16px;
                min-height: 16px;
                margin: -6px;
            }
        }

        slider {
            border-radius: 50%;
            background-color: $selected_bg_color;
        }
        trough {
            outline-offset: 2px;
            -gtk-outline-radius: 2px;
            margin: 5px;
            background-color: $trough_bg;
            border-radius: 2.5px;

            highlight {
                border-radius: 2.5px;
                background-color: $selected_bg_color;
            }
        }
    }

    // Check and Radio Items
    @include check-radio('',disabled,indeterminate);

    radiobutton radio,
    checkbutton check {
      min-width: 16px;
      min-height: 16px;
      margin: 0 2px;
      &:only-child { margin: 0; }
    }

    // Switches
    switch {
        font-size: 1px;
        outline-color: transparent;

        slider {
            min-width: 45px;
            min-height: 19px;
        }

        &, slider {
            color: transparent;
            background-size: 45px 19px;
            background-repeat: no-repeat;
            background-position: right center;

            &:dir(rtl) { background-position: left center; }
        }

        background-image: -gtk-scaled(url("assets/switch#{$asset_suffix}.png"),url("assets/switch#{$asset_suffix}@2.png"));

        &:checked { background-image: -gtk-scaled(url("assets/switch-active#{$asset_suffix}.png"),url("assets/switch-active#{$asset_suffix}@2.png")); }
        &:disabled { opacity: 0.4; }
    }

    // Scrollbars
    scrollbar {
        @include widget_scrollbar(button, slider, trought, hover, disabled);
    
        $_slider_margin: 3px;
        $_slider_fine_tune_margin: 4px;

        &.overlay-indicator {
            &:not(.dragging):not(.hovering) {
                slider {
                    margin: 0;
                }
                // sizing
                &.vertical slider {
                    min-width: 4px;
                    margin-top: $_slider_margin - 1px;
                    margin-bottom: $_slider_margin - 1px;
                }
            }
        }

        // sizing
        &.vertical {
            &.fine-tune slider {
                min-width: 4px;
                margin: $_slider_fine_tune_margin;
            }
            slider {
                min-height: 42px;
                min-width: 6px;
                margin: $_slider_margin;
            }
        }
    }

    // Lists
    @include lists(list, row, label, disabled);
    list { color: $fg_color; }
    row.activatable {
        padding: 3px;
        color: $fg_color;

        &:hover { background-color: $button_bg; }
        &:active { color: $fg_color; }
        &:selected {
            color: $selected_fg_color;
            background-color: $selected_bg_color;

            &:active { color: $selected_fg_color; }
            &:hover { background-color: mix(black, $selected_bg_color, 10%); }
            &:disabled {
                color: transparentize($selected_fg_color, 0.3);
                background-color: transparentize($selected_bg_color, 0.3);
                label { color: inherit; }
            }
        }
    }
    @at-root %menu {
        .menu, menu {
            @include widget_menu(menuitem, disabled, separator, 'background-color', arrow);
            arrow {
                min-width: 16px;
                min-height: 16px;

                &.top {
                    -gtk-icon-source: -gtk-icontheme('pan-up-symbolic');
                    border-bottom: 1px solid mix($fg_color, $raven_bg, 10%);
                }
                &.bottom {
                    -gtk-icon-source: -gtk-icontheme('pan-down-symbolic');
                    border-top: 1px solid mix($fg_color, $raven_bg, 10%);
                }
            }
        }
        .csd.popup decoration {
            @extend %widget_menu_popup
        }
    }

    // Calendar
    @include widget_calendar(calendar,indeterminate);
}
