$ASSETS_DIR: '$ASSETS_DIR/' + $THEME;

QWidget {
    background-color: $COLOR_BACKGROUND_NORMAL;
    border: 0px solid $COLOR_BACKGROUND_NORMAL;
    padding: 0px;
    color: $COLOR_FOREGROUND_LIGHT;
    selection-background-color: $COLOR_SELECTION_NORMAL;
    selection-color: $COLOR_FOREGROUND_LIGHT;

    &:disabled {
        color: $COLOR_FOREGROUND_DARK;
        selection-background-color: $COLOR_SELECTION_DARK;
        selection-color: $COLOR_FOREGROUND_DARK;
    }

    &::item {

        &:selected {
            background-color: $COLOR_SELECTION_NORMAL;
        }

        &:hover {
            background-color: $COLOR_SELECTION_LIGHT;
            color: $COLOR_BACKGROUND_NORMAL;
        }
    }
}

/* This adjusts the splitter in the dock widget, not qsplitter
 * https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qmainwindow
 */
QMainWindow {

    &::separator {
        background-color: $COLOR_BACKGROUND_NORMAL;
        border: 0px solid $COLOR_BACKGROUND_DARK;
        spacing: 0px;
        padding: 2px;

        &:hover {
            background-color: $COLOR_BACKGROUND_LIGHT;
            border: 0px solid $COLOR_SELECTION_LIGHT;
        }

        &:horizontal {
            width: 5px;
            margin-top: 2px;
            margin-bottom: 2px;
            image: url($ASSETS_DIR + '/toolbar_separator_vertical.svg');
        }

        &:vertical {
            height: 5px;
            margin-left: 2px;
            margin-right: 2px;
            image: url($ASSETS_DIR + '/toolbar_separator_horizontal.svg');
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtooltip */
QToolTip {
    background-color: $COLOR_SELECTION_LIGHT;
    border: $BORDER_DARK;
    color: $COLOR_BACKGROUND_DARK;

    /* Remove padding, for fix combo box tooltip */
    padding: 0px;

    /* Remove opacity, fix #174 - may need to use RGBA */
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qstatusbar */
QStatusBar {
    border: $BORDER_NORMAL;

    /* Fixes Spyder #9120, #9121 */
    background: $COLOR_BACKGROUND_NORMAL;

    /* Fixes #205, white vertical borders separating items */
    &::item {
        border: 1px inset $COLOR_BACKGROUND_LIGHT;
    }

    QToolTip {
        background-color: $COLOR_SELECTION_LIGHT;
        border: $BORDER_DARK;
        color: $COLOR_BACKGROUND_DARK;

        /* Remove padding, for fix combo box tooltip */
        padding: 0px;

        /* Reducing transparency to read better */
        opacity: $OPACITY_TOOLTIP;
    }

    QLabel {
        /* Fixes Spyder #9120, #9121 */
        background: transparent;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcheckbox */
QCheckBox {
    background-color: transparent;
    color: $COLOR_FOREGROUND_LIGHT;
    spacing: 4px;
    outline: none;
    padding-top: 4px;
    padding-bottom: 4px;

    &:focus {
        border: none;
    }

    &:disabled {
        background-color: transparent;
        color: $COLOR_FOREGROUND_DARK;
    }

    &::indicator {
        margin-left: 4px;
        height: 16px;
        width: 16px;

        &:unchecked {
            image: url($ASSETS_DIR + '/checkbox_unchecked.svg');

            &:hover,
            &:focus,
            &:pressed {
                border: none;
                image: url($ASSETS_DIR + '/checkbox_unchecked--focus.svg');
            }

            &:disabled {
                image: url($ASSETS_DIR + '/checkbox_unchecked--disabled.svg');
            }
        }

        &:checked {
            image: url($ASSETS_DIR + '/checkbox_checked.svg');

            &:hover,
            &:focus,
            &:pressed {
                border: none;
                image: url($ASSETS_DIR + '/checkbox_checked--focus.svg');
            }

            &:disabled {
                image: url($ASSETS_DIR + '/checkbox_checked--disabled.svg');
            }
        }

        &:indeterminate {
            image: url($ASSETS_DIR + '/checkbox_indeterminate.svg');

            &:disabled {
                image: url($ASSETS_DIR + '/checkbox_indeterminate--disabled.svg');
            }

            &:focus,
            &:hover,
            &:pressed {
                image: url($ASSETS_DIR + '/checkbox_indeterminate--focus.svg');
            }
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qgroupbox */
QGroupBox {
    font-weight: bold;
    border: $BORDER_LIGHT;
    border-radius: $SIZE_BORDER_RADIUS;
    padding: 4px;
    margin-top: 16px;

    &::title {
        subcontrol-origin: margin;
        subcontrol-position: top left;
        left: 3px;
        padding-left: 3px;
        padding-right: 5px;
        padding-top: 8px;
        padding-bottom: 16px;
    }

    &::indicator {
        margin-left: 2px;
        height: 16px;
        width: 16px;

        &:unchecked {
            border: none;
            image: url($ASSETS_DIR + '/checkbox_unchecked.svg');

            &:hover,
            &:focus,
            &:pressed {
                border: none;
                image: url($ASSETS_DIR + '/checkbox_unchecked--focus.svg');
            }

            &:disabled {
                image: url($ASSETS_DIR + '/checkbox_unchecked--disabled.svg');
            }
        }

        &:checked {
            border: none;
            image: url($ASSETS_DIR + '/checkbox_checked.svg');


            &:hover,
            &:focus,
            &:pressed {
                border: none;
                image: url($ASSETS_DIR + '/checkbox_checked--focus.svg');
            }

            &:disabled {
                image: url($ASSETS_DIR + '/checkbox_checked--disabled.svg');
            }
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qradiobutton */
QRadioButton {
    background-color: transparent;
    color: $COLOR_FOREGROUND_LIGHT;
    spacing: 4px;
    padding: 0px;
    border: none;
    outline: none;

    &:focus {
        border: none;
    }

    &:disabled {
        background-color: transparent;
        color: $COLOR_FOREGROUND_DARK;
        border: none;
        outline: none;
    }

    QWidget {
        background-color: $COLOR_BACKGROUND_DARK;
        color: $COLOR_FOREGROUND_LIGHT;
        spacing: 0px;
        padding: 0px;
        outline: none;
        border: none;
    }

    &::indicator {
        border: none;
        outline: none;
        margin-left: 4px;
        height: 16px;
        width: 16px;

        &:unchecked {
            image: url($ASSETS_DIR + '/radio_unchecked.svg');

            &:hover,
            &:focus,
            &:pressed {
                border: none;
                outline: none;
                image: url($ASSETS_DIR + '/radio_unchecked--focus.svg');
            }

            &:disabled {
                image: url($ASSETS_DIR + '/radio_unchecked--disabled.svg');
            }
        }

        &:checked {
            border: none;
            outline: none;
            image: url($ASSETS_DIR + '/radio_checked.svg');

            &:hover,
            &:focus,
            &:pressed {
                border: none;
                outline: none;
                image: url($ASSETS_DIR + '/radio_checked--focus.svg');
            }

            &:disabled {
                outline: none;
                image: url($ASSETS_DIR + '/radio_checked--disabled.svg');
            }
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qmenubar */
QMenuBar {
    background-color: $COLOR_BACKGROUND_NORMAL;
    padding: 2px;
    border: 0px;
    border-bottom: $BORDER_LIGHT;
    color: $COLOR_FOREGROUND_LIGHT;

    &:focus {
        border-bottom: $BORDER_SELECTION_LIGHT;
    }

    &::item {
        background: transparent;
        padding: 4px;

        &:selected {
            padding: 4px;
            background: transparent;
            border: 0px solid $COLOR_BACKGROUND_NORMAL;
        }

        &:pressed {
            padding: 4px;
            border: 0px solid $COLOR_BACKGROUND_NORMAL;
            background-color: $COLOR_SELECTION_LIGHT;
            color: $COLOR_FOREGROUND_LIGHT;
            margin-bottom: 0px;
            padding-bottom: 0px;
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qmenu */
QMenu {
    border: 0px;
    color: $COLOR_FOREGROUND_LIGHT;
    margin: 0px;

    &::separator {
        height: 1px;
        background-color: $COLOR_BACKGROUND_LIGHT;
        color: $COLOR_FOREGROUND_LIGHT;
    }

    &::icon {
        margin: 0px;
        padding-left: 8px;
    }

    &::item {
        background-color: $COLOR_BACKGROUND_NORMAL;
        padding: 4px 24px 4px 24px;
        /* Reserve space for selection border */
        border: 1px transparent $COLOR_BACKGROUND_NORMAL;

        &:selected {
            color: $COLOR_FOREGROUND_LIGHT;
        }
    }

    &::indicator {
        width: 12px;
        height: 12px;
        padding-left: 6px;

        /* non-exclusive indicator = check box style indicator (see QActionGroup::setExclusive) */
        &:non-exclusive {

            &:unchecked {
                image: url($ASSETS_DIR + '/checkbox_unchecked.svg');

                &:selected {
                    image: url($ASSETS_DIR + '/checkbox_unchecked--disabled.svg');
                }
            }

            &:checked {
                image: url($ASSETS_DIR + '/checkbox_checked.svg');

                &:selected {
                    image: url($ASSETS_DIR + '/checkbox_checked--disabled.svg');
                }
            }
        }

        /* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */
        &:exclusive {

            &:unchecked {
                image: url($ASSETS_DIR + '/radio_unchecked.svg');

                &:selected {
                    image: url($ASSETS_DIR + '/radio_unchecked--disabled.svg');
                }
            }

            &:checked {
                image: url($ASSETS_DIR + '/radio_checked.svg');

                &:selected {
                    image: url($ASSETS_DIR + '/radio_checked--disabled.svg');
                }
            }
        }
    }

    &::right-arrow {
        margin: 5px;
        image: url($ASSETS_DIR + '/arrow_right.svg');
        height: 12px;
        width: 12px;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcombobox */
QAbstractItemView {
    alternate-background-color: $COLOR_BACKGROUND_DARK;
    color: $COLOR_FOREGROUND_LIGHT;
    border: $BORDER_NORMAL;
    border-radius: $SIZE_BORDER_RADIUS;

    QLineEdit {
        padding: 2px;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qabstractscrollarea */
QAbstractScrollArea {
    background-color: $COLOR_BACKGROUND_DARK;
    border: $BORDER_NORMAL;
    border-radius: $SIZE_BORDER_RADIUS;
    padding: 2px;
    /* fix #159 */
    min-height: 1.25em;
    /* fix #159 */
    color: $COLOR_FOREGROUND_LIGHT;

    &:disabled {
        color: $COLOR_FOREGROUND_DARK;
    }
}

QScrollArea QWidget QWidget:disabled {
    background-color: $COLOR_BACKGROUND_DARK;
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qscrollbar */
QScrollBar {

    &:horizontal {
        height: 16px;
        margin: 2px 16px 2px 16px;
        border: $BORDER_NORMAL;
        border-radius: $SIZE_BORDER_RADIUS;
        background-color: $COLOR_BACKGROUND_DARK;
    }

    &:vertical {
        background-color: $COLOR_BACKGROUND_DARK;
        width: 16px;
        margin: 16px 2px 16px 2px;
        border: $BORDER_NORMAL;
        border-radius: $SIZE_BORDER_RADIUS;
    }

    &::handle {

        &:horizontal {
            background-color: $COLOR_BACKGROUND_LIGHT;
            border: $BORDER_NORMAL;
            border-radius: $SIZE_BORDER_RADIUS;
            min-width: 8px;

            &:hover {
                background-color: $COLOR_SELECTION_LIGHT;
                border: $BORDER_SELECTION_LIGHT;
                border-radius: $SIZE_BORDER_RADIUS;
                min-width: 8px;
            }

            &:focus {
                border: $BORDER_SELECTION_NORMAL;
            }
        }

        &:vertical {
            background-color: $COLOR_BACKGROUND_LIGHT;
            border: $BORDER_NORMAL;
            min-height: 8px;
            border-radius: $SIZE_BORDER_RADIUS;

            &:hover {
                background-color: $COLOR_SELECTION_LIGHT;
                border: $BORDER_SELECTION_LIGHT;
                border-radius: $SIZE_BORDER_RADIUS;
                min-height: 8px;
            }

            &:focus {
                border: $BORDER_SELECTION_NORMAL;
            }
        }
    }

    &::add-line {

        &:horizontal {
            margin: 0px 0px 0px 0px;
            border-image: url($ASSETS_DIR + '/arrow_right--disabled.svg');
            height: 12px;
            width: 12px;
            subcontrol-position: right;
            subcontrol-origin: margin;

            &:hover,
            &:on {
                border-image: url($ASSETS_DIR + '/arrow_right.svg');
                height: 12px;
                width: 12px;
                subcontrol-position: right;
                subcontrol-origin: margin;
            }
        }

        &:vertical {
            margin: 3px 0px 3px 0px;
            border-image: url($ASSETS_DIR + '/arrow_down--disabled.svg');
            height: 12px;
            width: 12px;
            subcontrol-position: bottom;
            subcontrol-origin: margin;

            &:hover,
            &:on {
                border-image: url($ASSETS_DIR + '/arrow_down.svg');
                height: 12px;
                width: 12px;
                subcontrol-position: bottom;
                subcontrol-origin: margin;
            }
        }
    }

    &::sub-line {
        &:horizontal {
            margin: 0px 3px 0px 3px;
            border-image: url($ASSETS_DIR + '/arrow_left--disabled.svg');
            height: 12px;
            width: 12px;
            subcontrol-position: left;
            subcontrol-origin: margin;

            &:hover,
            &:on {
                border-image: url($ASSETS_DIR + '/arrow_left.svg');
                height: 12px;
                width: 12px;
                subcontrol-position: left;
                subcontrol-origin: margin;
            }
        }

        &:vertical {
            margin: 3px 0px 3px 0px;
            border-image: url($ASSETS_DIR + '/arrow_up--disabled.svg');
            height: 12px;
            width: 12px;
            subcontrol-position: top;
            subcontrol-origin: margin;

            &:hover,
            &:on {
                border-image: url($ASSETS_DIR + '/arrow_up.svg');
                height: 12px;
                width: 12px;
                subcontrol-position: top;
                subcontrol-origin: margin;
            }
        }
    }

    &::up-arrow:horizontal,
    &::down-arrow:horizontal {
        background: none;
    }

    &::up-arrow:vertical,
    &::down-arrow:vertical {
        background: none;
    }

    &::add-page:horizontal,
    &::sub-page:horizontal {
        background: none;
    }

    &::add-page:vertical,
    &::sub-page:vertical {
        background: none;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-specific-widgets */
QTextEdit {
    background-color: $COLOR_BACKGROUND_DARK;
    color: $COLOR_FOREGROUND_LIGHT;
    border-radius: $SIZE_BORDER_RADIUS;
    border: $BORDER_LIGHT;

    &:disabled {
        background-color: $COLOR_BACKGROUND_NORMAL;
    }

    &:hover {
        border: $BORDER_SELECTION_LIGHT;
        color: $COLOR_FOREGROUND_LIGHT;
    }

    &:focus {
        border: $BORDER_SELECTION_NORMAL;
    }

    &:selected {
        background: $COLOR_SELECTION_NORMAL;
        color: $COLOR_BACKGROUND_NORMAL;
    }
}

QPlainTextEdit {
    background-color: $COLOR_BACKGROUND_DARK;
    color: $COLOR_FOREGROUND_LIGHT;
    border-radius: $SIZE_BORDER_RADIUS;
    border: $BORDER_LIGHT;

    &:disabled {
        background-color: $COLOR_BACKGROUND_NORMAL;
    }

    &:hover {
        border: $BORDER_SELECTION_LIGHT;
        color: $COLOR_FOREGROUND_LIGHT;
    }

    &:focus {
        border: $BORDER_SELECTION_NORMAL;
    }

    &:selected {
        background: $COLOR_SELECTION_NORMAL;
        color: $COLOR_BACKGROUND_NORMAL;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qsizegrip */
QSizeGrip {
    background: transparent;
    width: 12px;
    height: 12px;
    image: url($ASSETS_DIR + '/window_grip.svg');
}

QStackedWidget {
    padding: 2px;
    border: $BORDER_DARK;
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtoolbar */
QToolBar {
    background-color: $COLOR_BACKGROUND_NORMAL;
    border: 0px;
    padding: 2px;
    font-weight: bold;
    spacing: 2px;

    QToolButton {
        background-color: $COLOR_BACKGROUND_NORMAL;
        border: $BORDER_LIGHT;

        &:hover {
            border: $BORDER_SELECTION_LIGHT;
        }

        &:checked {
            border: $BORDER_DARK;
            background-color: $COLOR_BACKGROUND_DARK;

            &:hover {
                border: $BORDER_SELECTION_LIGHT;
            }
        }
    }

    &::handle {

        &:horizontal {
            width: 16px;
            image: url($ASSETS_DIR + '/toolbar_move_horizontal.svg');
        }

        &:vertical {
            height: 16px;
            image: url($ASSETS_DIR + '/toolbar_move_vertical.svg');
        }
    }

    &::separator {

        &:horizontal {
            width: 16px;
            image: url($ASSETS_DIR + '/toolbar_separator_horizontal.svg');
        }

        &:vertical {
            height: 16px;
            image: url($ASSETS_DIR + '/toolbar_separator_vertical.svg');
        }
    }
}

QToolButton#qt_toolbar_ext_button {
    background: $COLOR_BACKGROUND_NORMAL;
    border: 0px;
    color: $COLOR_FOREGROUND_LIGHT;
    image: url($ASSETS_DIR + '/arrow_right.svg');
}

QAbstractSpinBox {
    background-color: $COLOR_BACKGROUND_DARK;
    border: $BORDER_LIGHT;
    color: $COLOR_FOREGROUND_LIGHT;

    /* This fixes 103, 111 */
    padding-top: 2px;

    /* This fixes 103, 111 */
    padding-bottom: 2px;
    padding-left: 4px;
    padding-right: 4px;
    border-radius: $SIZE_BORDER_RADIUS;
    /* min-width: 5px; removed to fix 109 */

    &:up-button {
        background-color: transparent $COLOR_BACKGROUND_DARK;
        subcontrol-origin: border;
        subcontrol-position: top right;
        border-left: $BORDER_NORMAL;
        border-bottom: $BORDER_NORMAL;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        margin: 1px;
        width: 12px;
        margin-bottom: -1px;
    }

    &::up-arrow,
    &::up-arrow:disabled,
    &::up-arrow:off {
        image: url($ASSETS_DIR + '/arrow_up--disabled.svg');
        height: 8px;
        width: 8px;
    }

    &::up-arrow:hover {
        image: url($ASSETS_DIR + '/arrow_up.svg');
    }

    &:down-button {
        background-color: transparent $COLOR_BACKGROUND_DARK;
        subcontrol-origin: border;
        subcontrol-position: bottom right;
        border-left: $BORDER_NORMAL;
        border-top: $BORDER_NORMAL;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        margin: 1px;
        width: 12px;
        margin-top: -1px;
    }

    &::down-arrow,
    &::down-arrow:disabled,
    &::down-arrow:off {
        image: url($ASSETS_DIR + '/arrow_down--disabled.svg');
        height: 8px;
        width: 8px;
    }

    &::down-arrow:hover {
        image: url($ASSETS_DIR + '/arrow_down.svg');
    }

    &:disabled {
        background-color: $COLOR_BACKGROUND_NORMAL;
    }

    &:hover {
        border: $BORDER_SELECTION_LIGHT;
        color: $COLOR_FOREGROUND_LIGHT;
    }

    &:focus {
        border: $BORDER_SELECTION_NORMAL;
    }

    &:selected {
        background: $COLOR_SELECTION_NORMAL;
        color: $COLOR_BACKGROUND_NORMAL;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qframe */
QLabel {
    background-color: transparent;
    border: 0px solid $COLOR_BACKGROUND_NORMAL;
    padding: 2px;
    margin: 0px;
    color: $COLOR_FOREGROUND_LIGHT;

    &:disabled {
        background-color: transparent;
        border: 0px solid $COLOR_BACKGROUND_NORMAL;
        color: $COLOR_FOREGROUND_DARK;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qabstractscrollarea */
QTextBrowser {
    background-color: $COLOR_BACKGROUND_DARK;
    border: $BORDER_NORMAL;
    color: $COLOR_FOREGROUND_LIGHT;
    border-radius: $SIZE_BORDER_RADIUS;

    &:disabled {
        background-color: $COLOR_BACKGROUND_DARK;
        border: $BORDER_NORMAL;
        color: $COLOR_FOREGROUND_DARK;
        border-radius: $SIZE_BORDER_RADIUS;
    }

    &:hover,
    &:!hover,
    &:selected,
    &:pressed {
        border: $BORDER_NORMAL;
    }
}

QGraphicsView {
    background-color: $COLOR_BACKGROUND_DARK;
    border: $BORDER_NORMAL;
    color: $COLOR_FOREGROUND_LIGHT;
    border-radius: $SIZE_BORDER_RADIUS;

    &:disabled {
        background-color: $COLOR_BACKGROUND_DARK;
        border: $BORDER_NORMAL;
        color: $COLOR_FOREGROUND_DARK;
        border-radius: $SIZE_BORDER_RADIUS;
    }

    &:hover,
    &:!hover,
    &:selected,
    &:pressed {
        border: $BORDER_NORMAL;
    }
}

QCalendarWidget {
    border: $BORDER_NORMAL;
    border-radius: $SIZE_BORDER_RADIUS;

    &:disabled {
        background-color: $COLOR_BACKGROUND_DARK;
        color: $COLOR_FOREGROUND_DARK;
    }
}

QLCDNumber {
    background-color: $COLOR_BACKGROUND_DARK;
    color: $COLOR_FOREGROUND_LIGHT;

    &:disabled {
        background-color: $COLOR_BACKGROUND_DARK;
        color: $COLOR_FOREGROUND_DARK;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qprogressbar */
QProgressBar {
    background-color: $COLOR_BACKGROUND_DARK;
    border: $BORDER_NORMAL;
    color: $COLOR_FOREGROUND_LIGHT;
    border-radius: $SIZE_BORDER_RADIUS;
    text-align: center;

    &:disabled {
        background-color: $COLOR_BACKGROUND_DARK;
        border: $BORDER_NORMAL;
        color: $COLOR_FOREGROUND_DARK;
        border-radius: $SIZE_BORDER_RADIUS;
        text-align: center;
    }

    &::chunk {
        background-color: $COLOR_SELECTION_NORMAL;
        color: $COLOR_BACKGROUND_DARK;
        border-radius: $SIZE_BORDER_RADIUS;

        &:disabled {
            background-color: $COLOR_SELECTION_DARK;
            color: $COLOR_FOREGROUND_DARK;
            border-radius: $SIZE_BORDER_RADIUS;
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qpushbutton */
QPushButton {
    background-color: $COLOR_BACKGROUND_LIGHT;
    border: $BORDER_NORMAL;
    color: $COLOR_FOREGROUND_LIGHT;
    border-radius: $SIZE_BORDER_RADIUS;
    padding: 3px;
    outline: none;
    /* Issue #194 - Special case of QPushButton inside dialogs, for better UI */
    QDialog & {
      min-width: 80px;
    }

    &:disabled {
        background-color: $COLOR_BACKGROUND_NORMAL;
        border: $BORDER_NORMAL;
        color: $COLOR_FOREGROUND_DARK;
        border-radius: $SIZE_BORDER_RADIUS;
        padding: 3px;
    }

    &:checked {
        background-color: $COLOR_BACKGROUND_NORMAL;
        border: $BORDER_NORMAL;
        border-radius: $SIZE_BORDER_RADIUS;
        padding: 3px;
        outline: none;

        &:disabled {
            background-color: $COLOR_BACKGROUND_DARK;
            border: $BORDER_NORMAL;
            color: $COLOR_FOREGROUND_DARK;
            border-radius: $SIZE_BORDER_RADIUS;
            padding: 3px;
            outline: none;
        }

        &:selected {
            background: $COLOR_SELECTION_NORMAL;
            color: $COLOR_BACKGROUND_NORMAL;
        }

    }

    &::menu-indicator {
        subcontrol-origin: padding;
        subcontrol-position: bottom right;
        bottom: 4px;
    }

    &:pressed {
        background-color: $COLOR_BACKGROUND_DARK;
        border: $BORDER_DARK;

        &:hover {
            border: $BORDER_SELECTION_LIGHT;
        }
    }

    &:hover {
        border: $BORDER_SELECTION_LIGHT;
        color: $COLOR_FOREGROUND_LIGHT;
    }

    &:selected {
        background: $COLOR_SELECTION_NORMAL;
        color: $COLOR_BACKGROUND_NORMAL;
    }

    &:hover {
        border: $BORDER_SELECTION_LIGHT;
        color: $COLOR_FOREGROUND_LIGHT;
    }

    &:focus {
        border: $BORDER_SELECTION_NORMAL;
    }

}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtoolbutton */
QToolButton {
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: $SIZE_BORDER_RADIUS;
    margin: 0px;
    padding: 2px;

    &:checked {
        background-color: transparent;
        border: $BORDER_SELECTION_NORMAL;

        &:disabled {
            border: $BORDER_SELECTION_DARK;
        }
    }

    &:pressed {
        margin: 1px;
        background-color: transparent;
        border: $BORDER_SELECTION_NORMAL;
    }

    &:disabled {
        border: none;
    }

    &:hover {
        border: $BORDER_SELECTION_LIGHT;
    }

    /* The subcontrols below are used only in the DelayedPopup mode */
    &[popupMode="0"] {
        /* Only for DelayedPopup */
        padding-right: 2px;
    }

    /* The subcontrols below are used only in the MenuButtonPopup mode */
    &[popupMode="1"] {
        /* Only for MenuButtonPopup */
        padding-right: 20px;

        &::menu-button {
            border: none;

            &:hover {
                border: none;
                border-left: 1px solid $COLOR_SELECTION_LIGHT;
                border-radius: 0;
            }
        }
    }

    /* The subcontrol below is used only in the InstantPopup or DelayedPopup mode */
    &[popupMode="2"] {
        /* Only for InstantPopup */
        padding-right: 2px;
    }

    &::menu-button {
        padding: 2px;
        border-radius: $SIZE_BORDER_RADIUS;
        border: $BORDER_NORMAL;
        width: 12px;
        outline: none;

        &:hover {
            border: $BORDER_SELECTION_LIGHT;
        }

        &:checked {
            &:hover {
                border: $BORDER_SELECTION_LIGHT;
            }
        }
    }

    &::menu-indicator {
        image: url($ASSETS_DIR + '/arrow_down.svg');
        height: 8px;
        width: 8px;
        top: 0;
        /* Exclude a shift for better image */
        left: -2px;
        /* Shift it a bit */
    }

    &::menu-arrow {
        image: url($ASSETS_DIR + '/arrow_down.svg');
        height: 8px;
        width: 8px;

        &:hover {
            image: url($ASSETS_DIR + '/arrow_down--focus.svg');
        }
    }
}

QCommandLinkButton {
    background-color: transparent;
    border: $BORDER_NORMAL;
    color: $COLOR_FOREGROUND_LIGHT;
    border-radius: $SIZE_BORDER_RADIUS;
    padding: 0px;
    margin: 0px;

    &:disabled {
        background-color: transparent;
        color: $COLOR_FOREGROUND_DARK;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcombobox */
QComboBox {
    border: $BORDER_LIGHT;
    border-radius: $SIZE_BORDER_RADIUS;
    background-color: $COLOR_BACKGROUND_DARK;
    selection-background-color: $COLOR_SELECTION_NORMAL;
    padding-left: 4px;
    padding-right: 36px;
    /* 4 + 16*2 See scrollbar size */

    /* Fixes #103, #111 */
    min-height: 1.5em;

    /* padding-top: 2px;     removed to fix #132 */
    /* padding-bottom: 2px;  removed to fix #132 */
    /* min-width: 75px;      removed to fix #109 */

    QAbstractItemView {
        border: $BORDER_NORMAL;
        border-radius: 0;
        background-color: $COLOR_BACKGROUND_DARK;
        selection-background-color: $COLOR_SELECTION_NORMAL;

        &:hover {
            background-color: $COLOR_BACKGROUND_DARK;
            color: $COLOR_FOREGROUND_LIGHT;
        }

        &:selected {
            background: $COLOR_SELECTION_NORMAL;
            color: $COLOR_BACKGROUND_NORMAL;
        }

        &:alternate {
            background: $COLOR_BACKGROUND_DARK;
        }

    }

    &:disabled {
        background-color: $COLOR_BACKGROUND_NORMAL;
        color: $COLOR_FOREGROUND_DARK;
    }

    &:hover {
        border: $BORDER_SELECTION_LIGHT;
    }

    &:focus {
        border: $BORDER_SELECTION_NORMAL;
    }

    &:on {
        selection-background-color: $COLOR_SELECTION_NORMAL;
    }

    /* Needed to remove indicator - fix #132 */
    &::indicator {
        border: none;
        border-radius: 0;
        background-color: transparent;
        selection-background-color: transparent;
        color: transparent;
        selection-color: transparent;

        /* Needed to remove indicator - fix #132 */
        &:alternate {
            background: $COLOR_BACKGROUND_DARK;
        }
    }

    &::item {

        &:alternate {
            background: $COLOR_BACKGROUND_DARK;
        }

        &:checked {
            font-weight: bold;
        }

        &:selected {
            border: 0px solid transparent;
        }
    }

    &::drop-down {
        subcontrol-origin: padding;
        subcontrol-position: top right;
        width: 12px;
        border-left: 1px solid $COLOR_BACKGROUND_NORMAL;
    }

    &::down-arrow {
        image: url($ASSETS_DIR + '/arrow_down--disabled.svg');
        height: 8px;
        width: 8px;

        &:on,
        &:hover,
        &:focus {
            image: url($ASSETS_DIR + '/arrow_down.svg');
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qslider */
QSlider {
    &:disabled {
        background: $COLOR_BACKGROUND_DARK;
    }

    &:focus {
        border: none;
    }

    &::groove {
        &:horizontal {
            background: $COLOR_BACKGROUND_DARK;
            border: $BORDER_NORMAL;
            height: 4px;
            margin: 0px;
            border-radius: $SIZE_BORDER_RADIUS;
        }

        &:vertical {
            background: $COLOR_BACKGROUND_DARK;
            border: $BORDER_NORMAL;
            width: 4px;
            margin: 0px;
            border-radius: $SIZE_BORDER_RADIUS;
        }
    }

    &::add-page {
        &:vertical {
            background: $COLOR_SELECTION_NORMAL;
            border: $BORDER_NORMAL;
            width: 4px;
            margin: 0px;
            border-radius: $SIZE_BORDER_RADIUS;

            :disabled {
                background: $COLOR_SELECTION_DARK;
            }
        }
    }

    &::sub-page {

        &:horizontal {
            background: $COLOR_SELECTION_NORMAL;
            border: $BORDER_NORMAL;
            height: 4px;
            margin: 0px;
            border-radius: $SIZE_BORDER_RADIUS;

            &:disabled {
                background: $COLOR_SELECTION_DARK;
            }
        }
    }

    &::handle {

        &:horizontal {
            background: $COLOR_FOREGROUND_DARK;
            border: $BORDER_NORMAL;
            width: 8px;
            height: 8px;
            margin: -8px 0px;
            border-radius: $SIZE_BORDER_RADIUS;

            &:hover {
                background: $COLOR_SELECTION_LIGHT;
                border: $BORDER_SELECTION_LIGHT;
            }

            &:focus {
                border: $BORDER_SELECTION_NORMAL;
            }
        }

        &:vertical {
            background: $COLOR_FOREGROUND_DARK;
            border: $BORDER_NORMAL;
            width: 8px;
            height: 8px;
            margin: 0 -8px;
            border-radius: $SIZE_BORDER_RADIUS;

            &:hover {
                background: $COLOR_SELECTION_LIGHT;
                border: $BORDER_SELECTION_LIGHT;
            }

            &:focus {
                border: $BORDER_SELECTION_NORMAL;
            }
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qlineedit */
QLineEdit {
    background-color: $COLOR_BACKGROUND_DARK;
    padding-top: 2px;
    /* This QLineEdit fix  103, 111 */
    padding-bottom: 2px;
    /* This QLineEdit fix  103, 111 */
    padding-left: 4px;
    padding-right: 4px;
    border-style: solid;
    border: $BORDER_LIGHT;
    border-radius: $SIZE_BORDER_RADIUS;
    color: $COLOR_FOREGROUND_LIGHT;

    &:disabled {
        background-color: $COLOR_BACKGROUND_NORMAL;
        color: $COLOR_FOREGROUND_DARK;
    }

    &:hover {
        border: $BORDER_SELECTION_LIGHT;
        color: $COLOR_FOREGROUND_LIGHT;
    }

    &:focus {
        border: $BORDER_SELECTION_NORMAL;
    }

    &:selected {
        background-color: $COLOR_SELECTION_NORMAL;
        color: $COLOR_BACKGROUND_NORMAL;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar */
QTabWidget {
    padding: 2px;
    selection-background-color: $COLOR_BACKGROUND_NORMAL;

    QWidget {
        /* Fixes #189 */
        border-radius: $SIZE_BORDER_RADIUS;
    }

    &::pane {
        border: $BORDER_NORMAL;
        border-radius: $SIZE_BORDER_RADIUS;
        margin: 0px;
        /* Fixes double border inside pane with pyqt5 */
        padding: 0px;

        &:selected {
            background-color: $COLOR_BACKGROUND_NORMAL;
            border: 1px solid $COLOR_SELECTION_NORMAL;
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar */
QTabBar {
    qproperty-drawBase: 0;
    border-radius: $SIZE_BORDER_RADIUS;
    margin: 0px;
    padding: 2px;
    border: 0;
    /* left: 5px; move to the right by 5px - removed for fix */

    &::close-button {
        border: 0;
        margin: 2px;
        padding: 2px;

        image: url($ASSETS_DIR + '/window_close.svg');

        &:hover {
            image: url($ASSETS_DIR + '/window_close--focus.svg');
        }

        &:pressed {
            image: url($ASSETS_DIR + '/window_close--pressed.svg');
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar */
QTabBar {

    &::tab {

        &:top:selected:disabled {
            border-bottom: 3px solid $COLOR_SELECTION_DARK;
            color: $COLOR_FOREGROUND_DARK;
            background-color: $COLOR_BACKGROUND_NORMAL;
        }

        &:bottom:selected:disabled {
            border-top: 3px solid $COLOR_SELECTION_DARK;
            color: $COLOR_FOREGROUND_DARK;
            background-color: $COLOR_BACKGROUND_NORMAL;
        }

        &:left:selected:disabled {
            border-right: 3px solid $COLOR_SELECTION_DARK;
            color: $COLOR_FOREGROUND_DARK;
            background-color: $COLOR_BACKGROUND_NORMAL;
        }

        &:right:selected:disabled {
            border-left: 3px solid $COLOR_SELECTION_DARK;
            color: $COLOR_FOREGROUND_DARK;
            background-color: $COLOR_BACKGROUND_NORMAL;
        }

        /* !selected and disabled */
        &:top:!selected:disabled {
            border-bottom: 3px solid $COLOR_BACKGROUND_DARK;
            color: $COLOR_FOREGROUND_DARK;
            background-color: $COLOR_BACKGROUND_DARK;
        }

        &:bottom:!selected:disabled {
            border-top: 3px solid $COLOR_BACKGROUND_DARK;
            color: $COLOR_FOREGROUND_DARK;
            background-color: $COLOR_BACKGROUND_DARK;
        }

        &:left:!selected:disabled {
            border-right: 3px solid $COLOR_BACKGROUND_DARK;
            color: $COLOR_FOREGROUND_DARK;
            background-color: $COLOR_BACKGROUND_DARK;
        }

        &:right:!selected:disabled {
            border-left: 3px solid $COLOR_BACKGROUND_DARK;
            color: $COLOR_FOREGROUND_DARK;
            background-color: $COLOR_BACKGROUND_DARK;
        }

        /* selected */
        &:top:!selected {
            border-bottom: 2px solid $COLOR_BACKGROUND_DARK;
            margin-top: 2px;
        }

        &:bottom:!selected {
            border-top: 2px solid $COLOR_BACKGROUND_DARK;
            margin-bottom: 3px;
        }

        &:left:!selected {
            border-left: 2px solid $COLOR_BACKGROUND_DARK;
            margin-right: 2px;
        }

        &:right:!selected {
            border-right: 2px solid $COLOR_BACKGROUND_DARK;
            margin-left: 2px;
        }

        &:top {
            background-color: $COLOR_BACKGROUND_NORMAL;
            color: $COLOR_FOREGROUND_LIGHT;
            margin-left: 2px;
            padding-left: 4px;
            padding-right: 4px;
            padding-top: 2px;
            padding-bottom: 2px;
            min-width: 5px;
            border-bottom: 3px solid $COLOR_BACKGROUND_NORMAL;
            border-top-left-radius: 3px;
            border-top-right-radius: 3px;

            &:selected {
                background-color: $COLOR_BACKGROUND_LIGHT;
                color: $COLOR_FOREGROUND_LIGHT;
                border-bottom: 3px solid $COLOR_SELECTION_NORMAL;
                border-top-left-radius: 3px;
                border-top-right-radius: 3px;
            }

            &:!selected:hover {
                border: $BORDER_SELECTION_LIGHT;
                border-bottom: 3px solid $COLOR_SELECTION_LIGHT;

                /* Fixes spyder-ide/spyder#9766 */
                padding-left: 4px;
                padding-right: 4px;
            }
        }

        &:bottom {
            color: $COLOR_FOREGROUND_LIGHT;
            border-top: 3px solid $COLOR_BACKGROUND_NORMAL;
            background-color: $COLOR_BACKGROUND_NORMAL;
            margin-left: 2px;
            padding-left: 4px;
            padding-right: 4px;
            padding-top: 2px;
            padding-bottom: 2px;
            border-bottom-left-radius: 3px;
            border-bottom-right-radius: 3px;
            min-width: 5px;

            &:selected {
                color: $COLOR_FOREGROUND_LIGHT;
                background-color: $COLOR_BACKGROUND_LIGHT;
                border-top: 3px solid $COLOR_SELECTION_NORMAL;
                border-bottom-left-radius: 3px;
                border-bottom-right-radius: 3px;
            }

            &:!selected:hover {
                border: $BORDER_SELECTION_LIGHT;
                border-top: 3px solid $COLOR_SELECTION_LIGHT;

                /* Fixes spyder-ide/spyder#9766 */
                padding-left: 4px;
                padding-right: 4px;
            }

        }

        &:left {
            color: $COLOR_FOREGROUND_LIGHT;
            background-color: $COLOR_BACKGROUND_NORMAL;
            margin-top: 2px;
            padding-left: 2px;
            padding-right: 2px;
            padding-top: 4px;
            padding-bottom: 4px;
            border-top-left-radius: 3px;
            border-bottom-left-radius: 3px;
            min-height: 5px;

            &:selected {
                color: $COLOR_FOREGROUND_LIGHT;
                background-color: $COLOR_BACKGROUND_LIGHT;
                border-right: 3px solid $COLOR_SELECTION_NORMAL;
            }

            &:!selected:hover {
                border: $BORDER_SELECTION_LIGHT;
                border-right: 3px solid $COLOR_SELECTION_LIGHT;
                padding: 0px;
            }
        }

        &:right {
            color: $COLOR_FOREGROUND_LIGHT;
            background-color: $COLOR_BACKGROUND_NORMAL;
            margin-top: 2px;
            padding-left: 2px;
            padding-right: 2px;
            padding-top: 4px;
            padding-bottom: 4px;
            border-top-right-radius: 3px;
            border-bottom-right-radius: 3px;
            min-height: 5px;

            &:selected {
                color: $COLOR_FOREGROUND_LIGHT;
                background-color: $COLOR_BACKGROUND_LIGHT;
                border-left: 3px solid $COLOR_SELECTION_NORMAL;

            }

            &:!selected:hover {
                border: $BORDER_SELECTION_LIGHT;
                border-left: 3px solid $COLOR_SELECTION_LIGHT;
                padding: 0px;
            }
        }
    }

    QToolButton {
        /* Fixes #136 */
        background-color: $COLOR_BACKGROUND_NORMAL;
        height: 12px;
        width: 12px;

        &:pressed {
            background-color: $COLOR_BACKGROUND_NORMAL;

            &:hover {
                border: $BORDER_SELECTION_LIGHT;
            }
        }

        &::left-arrow {
            &:enabled {
                image: url($ASSETS_DIR + '/arrow_left.svg');
            }

            &:disabled {
                image: url($ASSETS_DIR + '/arrow_left--disabled.svg');
            }
        }

        &::right-arrow {
            &:enabled {
                image: url($ASSETS_DIR + '/arrow_right.svg');
            }

            &:disabled {
                image: url($ASSETS_DIR + '/arrow_right--disabled.svg');
            }
        }
    }
}

QDockWidget {
    outline: $BORDER_NORMAL;
    background-color: $COLOR_BACKGROUND_DARK;
    border: $BORDER_NORMAL;
    border-radius: $SIZE_BORDER_RADIUS;
    titlebar-close-icon: url($ASSETS_DIR + '/window_close.svg');
    titlebar-normal-icon: url($ASSETS_DIR + '/window_undock.svg');



    &::title {
        /* Better size for title bar */
        padding: 6px;
        spacing: 4px;
        border: none;
        background-color: $COLOR_BACKGROUND_NORMAL;
    }

    &::close-button {
        background-color: $COLOR_BACKGROUND_NORMAL;
        border-radius: $SIZE_BORDER_RADIUS;
        border: none;

        &:hover {
            image: url($ASSETS_DIR + '/window_close--focus.svg');
        }

        &:pressed {
            image: url($ASSETS_DIR + '/window_close--pressed.svg');
        }
    }

    &::float-button {
        background-color: $COLOR_BACKGROUND_NORMAL;
        border-radius: $SIZE_BORDER_RADIUS;
        border: none;

        &:hover {
            image: url($ASSETS_DIR + '/window_undock--focus.svg');
        }

        &:pressed {
            image: url($ASSETS_DIR + '/window_undock--pressed.svg');
        }
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtreeview
 * https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qlistview
 * https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtableview
 */
QTreeView {

    &:branch {

        &:selected,
        &:hover {
            background: url($ASSETS_DIR + '/transparent.svg');
        }

        &:has-siblings:!adjoins-item {
            border-image: url($ASSETS_DIR + '/branch_line.svg') 0;
        }

        &:has-siblings:adjoins-item {
            border-image: url($ASSETS_DIR + '/branch_more.svg') 0;
        }

        &:!has-children:!has-siblings:adjoins-item {
            border-image: url($ASSETS_DIR + '/branch_end.svg') 0;
        }

        &:has-children:!has-siblings:closed,
        &:closed:has-children:has-siblings {
            border-image: none;
            image: url($ASSETS_DIR + '/branch_closed.svg');
        }

        &:open:has-children:!has-siblings,
        &:open:has-children:has-siblings {
            border-image: none;
            image: url($ASSETS_DIR + '/branch_open.svg');
        }

        &:has-children:!has-siblings:closed:hover,
        &:closed:has-children:has-siblings:hover {
            image: url($ASSETS_DIR + '/branch_closed--focus.svg');
        }

        &:open:has-children:!has-siblings:hover,
        &:open:has-children:has-siblings:hover {
            image: url($ASSETS_DIR + '/branch_open--focus.svg');
        }
    }
}

QTreeView,
QListView {

    &::indicator {

        &:checked {
            image: url($ASSETS_DIR + '/checkbox_checked.svg');

            &:hover,
            &:focus,
            &:pressed {
                image: url($ASSETS_DIR + '/checkbox_checked--focus.svg');
            }
        }

        &:unchecked {
            image: url($ASSETS_DIR + '/checkbox_unchecked.svg');

            &:hover,
            &:focus,
            &:pressed {
                image: url($ASSETS_DIR + '/checkbox_unchecked--focus.svg');
            }
        }

        &:indeterminate {
            image: url($ASSETS_DIR + '/checkbox_indeterminate.svg');

            &:hover,
            &:focus,
            &:pressed {
                image: url($ASSETS_DIR + '/checkbox_indeterminate--focus.svg');
            }
        }
    }
}

QTreeView,
QListView,
QTableView,
QColumnView {
    background-color: $COLOR_BACKGROUND_DARK;
    border: $BORDER_NORMAL;
    color: $COLOR_FOREGROUND_LIGHT;
    gridline-color: $COLOR_BACKGROUND_NORMAL;
    border-radius: $SIZE_BORDER_RADIUS;

    &:focus {
        border: $BORDER_SELECTION_NORMAL;
    }

    &:disabled {
        background-color: $COLOR_BACKGROUND_DARK;
        color: $COLOR_FOREGROUND_DARK;
    }

    &:selected {
        background-color: $COLOR_SELECTION_NORMAL;
        color: $COLOR_BACKGROUND_NORMAL;
    }

    &:hover {
        background-color: $COLOR_BACKGROUND_DARK;
        border: $BORDER_SELECTION_LIGHT;
    }

    &::item {

        &:pressed {
            background-color: $COLOR_SELECTION_NORMAL;
        }

        &:selected {

            &:hover {
                background: $COLOR_SELECTION_NORMAL;
                color: $COLOR_BACKGROUND_DARK;
            }

            &:active {
                background-color: $COLOR_SELECTION_NORMAL;
            }
        }

        &:!selected {

            &:hover {
                outline: 0;
                color: $COLOR_SELECTION_LIGHT;
                background-color: $COLOR_BACKGROUND_NORMAL;
            }
        }
    }
}

QTableCornerButton {
    &::section {
        background-color: $COLOR_BACKGROUND_NORMAL;
        border: 1px transparent $COLOR_BACKGROUND_NORMAL;
        border-radius: 0px;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qheaderview */
QHeaderView {
    background-color: $COLOR_BACKGROUND_NORMAL;
    border: 0px transparent $COLOR_BACKGROUND_NORMAL;
    padding: 0px;
    margin: 0px;
    border-radius: 0px;

    &:disabled {
        background-color: $COLOR_BACKGROUND_NORMAL;
        border: 1px transparent $COLOR_BACKGROUND_NORMAL;
        padding: 2px;
    }

    &::section {
        background-color: $COLOR_BACKGROUND_NORMAL;
        color: $COLOR_FOREGROUND_LIGHT;
        padding: 2px;
        border-radius: 0px;
        text-align: left;

        &:checked {
            color: $COLOR_FOREGROUND_LIGHT;
            background-color: $COLOR_BACKGROUND_NORMAL;

            &:disabled {
                color: $COLOR_FOREGROUND_DARK;
                background-color: $COLOR_BACKGROUND_DARK;
            }
        }

        &::horizontal {
            padding-left: 4px;
            padding-right: 4px;
            border-left: $BORDER_DARK;

            &::first,
            &::only-one {
                border-left: $BORDER_NORMAL;
            }

            &:disabled {
                color: $COLOR_FOREGROUND_DARK;
            }
        }

        &::vertical {
            padding-left: 4px;
            padding-right: 4px;
            border-top: $BORDER_DARK;

            &::first,
            &::only-one {
                border-top: $BORDER_NORMAL;
            }

            &:disabled {
                color: $COLOR_FOREGROUND_DARK;
            }
        }
    }

    &::down-arrow {
        /* Those settings (border/width/height/background-color) solve bug */
        /* transparent arrow background and size */
        background-color: $COLOR_BACKGROUND_NORMAL;
        border: none;
        height: 12px;
        width: 12px;
        padding-left: 2px;
        padding-right: 2px;
        image: url($ASSETS_DIR + '/arrow_down.svg');
    }

    &::up-arrow {
        background-color: $COLOR_BACKGROUND_NORMAL;
        border: none;
        height: 12px;
        width: 12px;
        padding-left: 2px;
        padding-right: 2px;
        image: url($ASSETS_DIR + '/arrow_up.svg');
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtoolbox */
QToolBox {
    padding: 0px;
    border: 0px;
    border: $BORDER_NORMAL;

    &:selected {
        padding: 0px;
        border: 2px solid $COLOR_SELECTION_NORMAL;
    }

    &::tab {
        background-color: $COLOR_BACKGROUND_DARK;
        border: $BORDER_NORMAL;
        color: $COLOR_FOREGROUND_LIGHT;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;

        &:disabled {
            color: $COLOR_FOREGROUND_DARK;
        }

        &:selected {
            background-color: $COLOR_BACKGROUND_LIGHT;
            border-bottom: 2px solid $COLOR_SELECTION_NORMAL;

            &:disabled {
                background-color: $COLOR_BACKGROUND_NORMAL;
                border-bottom: 2px solid $COLOR_SELECTION_DARK;
            }
        }

        &:!selected {
            background-color: $COLOR_BACKGROUND_NORMAL;
            border-bottom: 2px solid $COLOR_BACKGROUND_NORMAL;

            &:disabled {
                background-color: $COLOR_BACKGROUND_DARK;
            }

        }

        &:hover {
            border-color: $COLOR_SELECTION_LIGHT;
            border-bottom: 2px solid $COLOR_SELECTION_LIGHT;
        }
    }

    QScrollArea QWidget QWidget {
        padding: 0px;
        border: 0px;
        background-color: $COLOR_BACKGROUND_DARK;
    }
}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qframe
 * https://doc.qt.io/qt-5/qframe.html#-prop
 * https://doc.qt.io/qt-5/qframe.html#details
 * https://stackoverflow.com/questions/14581498/qt-stylesheet-for-hline-vline-color
 *
 * (dot) .QFrame  fix #141, #126, #123
 */
.QFrame {
    border-radius: $SIZE_BORDER_RADIUS;
    border: $BORDER_NORMAL;

    /* No frame */
    &[frameShape="0"] {
        border-radius: $SIZE_BORDER_RADIUS;
        border: 1px transparent $COLOR_BACKGROUND_NORMAL;
    }

    /* HLine */
    &[frameShape="4"] {
        max-height: 2px;
        border: none;
        background-color: $COLOR_BACKGROUND_NORMAL;
    }

    /* HLine */
    &[frameShape="5"] {
        max-width: 2px;
        border: none;
        background-color: $COLOR_BACKGROUND_NORMAL;
    }

}

/* https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qsplitter */
QSplitter {
    background-color: $COLOR_BACKGROUND_NORMAL;
    spacing: 0px;
    padding: 0px;
    margin: 0px;

    &::handle {
        background-color: $COLOR_BACKGROUND_NORMAL;
        border: 0px solid $COLOR_BACKGROUND_DARK;
        spacing: 0px;
        padding: 1px;
        margin: 0px;

        &:hover {
            background-color: $COLOR_BACKGROUND_LIGHT;
        }

        &:horizontal {
            width: 3px;
            image: url($ASSETS_DIR + '/line_vertical.svg');
        }

        &:vertical {
            height: 3px;
            image: url($ASSETS_DIR + '/line_horizontal.svg');
        }
    }
}

QDateEdit, QDateTimeEdit {
    selection-background-color: $COLOR_SELECTION_NORMAL;
    border-style: solid;
    border: $BORDER_NORMAL;
    border-radius: $SIZE_BORDER_RADIUS;

    /* This fixes 103, 111 */
    padding-top: 2px;

    /* This fixes 103, 111 */
    padding-bottom: 2px;
    padding-left: 4px;
    padding-right: 4px;
    min-width: 10px;

    &:on {
        selection-background-color: $COLOR_SELECTION_NORMAL;
    }

    &::drop-down {
        subcontrol-origin: padding;
        subcontrol-position: top right;
        width: 12px;
        border-left: 1px solid $COLOR_BACKGROUND_NORMAL;
    }

    &::down-arrow {
        image: url($ASSETS_DIR + '/arrow_down--disabled.svg');
        height: 8px;
        width: 8px;

        &:on,
        &:hover,
        &:focus {
            image: url($ASSETS_DIR + '/arrow_down.svg');
        }

    }

    QAbstractItemView {
        background-color: $COLOR_BACKGROUND_DARK;
        border-radius: $SIZE_BORDER_RADIUS;
        border: $BORDER_NORMAL;
        selection-background-color: $COLOR_SELECTION_NORMAL;
    }
}


QAbstractView {

    &:hover {
        border: $BORDER_SELECTION_LIGHT;
        color: $COLOR_FOREGROUND_LIGHT;
    }

    &:selected {
        background: $COLOR_SELECTION_NORMAL;
        color: $COLOR_BACKGROUND_NORMAL;
    }
}


PlotWidget {
    /* Fix cut labels in plots #134 */
    padding: 0px;
}
