/*
Enabled vs Disabled logic in most of stylesheets

- global font color
    Enabled - should be same globally except placeholders
    Disabled - font color is greyed out

- global active/hover
   Enabled - color motive of borders and bg color
       - combobox, slider, views, buttons, checkbox, radiobox, inputs

- QLineEdit, QTextEdit, QPlainTextEdit, QAbstractSpinBox
    Enabled - bg has lighter or darker color
    Disabled - bg has same color as background

- QComboBox, QPushButton, QToolButton
    Enabled - slightly lighter color
    Disabled - even lighter color
*/

* {
    font-size: 9pt;
    font-family: "Noto Sans";
    font-weight: 450;
    outline: none;
}

*[font-style="monospace"] {
    font-family: "Noto Sans Mono";
}

QWidget {
    color: {color:font};
    background: {color:bg};
    border-radius: 0px;
}

QWidget:disabled {
    color: {color:font-disabled};
}

/* Some DCCs have set borders to solid color */
QScrollArea {
    border: none;
}

QLabel {
    background: transparent;
}

/* Inputs */
QAbstractSpinBox, QLineEdit, QPlainTextEdit, QTextEdit {
    border: 1px solid {color:border};
    border-radius: 0.2em;
    background: {color:bg-inputs};
    padding: 0.1em;
}

QAbstractSpinBox:disabled, QLineEdit:disabled, QPlainTextEdit:disabled, QTextEdit:disabled {
    background: {color:bg-inputs-disabled};
}
QAbstractSpinBox:hover, QLineEdit:hover, QPlainTextEdit:hover, QTextEdit:hover{
    border-color: {color:border-hover};
}
QAbstractSpinBox:focus, QLineEdit:focus, QPlainTextEdit:focus, QTextEdit:focus{
    border-color: {color:border-focus};
}

QAbstractSpinBox:up-button {
    margin: 0px;
    background-color: transparent;
    subcontrol-origin: border;
    subcontrol-position: top right;
    border-top-right-radius: 0.3em;
    border-top: 0px solid transparent;
    border-right: 0px solid transparent;
    border-left: 1px solid {color:border};
    border-bottom: 1px solid {color:border};
}

QAbstractSpinBox:down-button {
    margin: 0px;
    background-color: transparent;
    subcontrol-origin: border;
    subcontrol-position: bottom right;
    border-bottom-right-radius: 0.3em;
    border-bottom: 0px solid transparent;
    border-right: 0px solid transparent;
    border-left: 1px solid {color:border};
    border-top: 1px solid {color:border};
}

QAbstractSpinBox:up-button:focus, QAbstractSpinBox:down-button:focus {
    border-color: {color:border-focus};
}
QAbstractSpinBox::up-arrow, QAbstractSpinBox::up-arrow:off {
    image: url(:/openpype/images/up_arrow.png);
    width: 0.5em;
    height: 1em;
    border-width: 1px;
}
QAbstractSpinBox::up-arrow:hover {
    image: url(:/openpype/images/up_arrow_on.png);
    bottom: 1;
}
QAbstractSpinBox::up-arrow:disabled {
    image: url(:/openpype/images/up_arrow_disabled.png);
}
QAbstractSpinBox::up-arrow:pressed {
    image: url(:/openpype/images/up_arrow_on.png);
    bottom: 0;
}

QAbstractSpinBox::down-arrow, QAbstractSpinBox::down-arrow:off {
    image: url(:/openpype/images/down_arrow.png);
    width: 0.5em;
    height: 1em;
    border-width: 1px;
}
QAbstractSpinBox::down-arrow:hover {
    image: url(:/openpype/images/down_arrow_on.png);
    bottom: 1;
}
QAbstractSpinBox::down-arrow:disabled {
    image: url(:/openpype/images/down_arrow_disabled.png);
}
QAbstractSpinBox::down-arrow:hover:pressed {
    image: url(:/openpype/images/down_arrow_on.png);
    bottom: 0;
}

/* Buttons */
QPushButton {
    text-align:center center;
    border: 0px solid transparent;
    border-radius: 0.2em;
    padding: 3px 5px 3px 5px;
    background: {color:bg-buttons};
    min-width: 0px; /* Substance Painter fix */
}

QPushButton:hover {
    background: {color:bg-buttons-hover};
    color: {color:font-hover};
}

QPushButton:pressed {}

QPushButton:disabled {
    background: {color:bg-buttons-disabled};
}

QPushButton:checked {
    background: {color:bg-buttons-checked};
}

QPushButton::menu-indicator  {
    subcontrol-origin: padding;
    subcontrol-position: right;
    width: 8px;
    height: 8px;
    padding-right: 5px;
}

QToolButton {
    border: 0px solid transparent;
    background: {color:bg-buttons};
    border-radius: 0.2em;
    padding: 2px;
}

QToolButton:hover {
    background: {color:bg-buttons-hover};
    color: {color:font-hover};
}

QToolButton:disabled {
    background: {color:bg-buttons-disabled};
}

QToolButton[popupMode="1"], QToolButton[popupMode="MenuButtonPopup"] {
    /* make way for the popup button */
    padding-right: 20px;
}

QToolButton::menu-button {
    width: 16px;
    background: transparent;
    border: 1px solid transparent;
    border-left: 1px solid qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 transparent, stop:0.2 {color:font}, stop:0.8 {color:font}, stop: 1 transparent);
    padding: 3px 0px 3px 0px;
    border-radius: 0;
}

QToolButton::menu-arrow {
    /* Offset arrow a little bit to center. */
    left: 1px; top: 1px;
}

QToolButton::menu-arrow:open {
    /* Don't offset arrow on open. */
    left: 0px; top: 0px;
}

/* QMenu */
QMenu {
    border: 1px solid #555555;
    background: {color:bg-inputs};
}

QMenu::icon {
    padding-left: 7px;
}

QMenu::item {
    padding: 6px 25px 6px 10px;
}

QMenu::item:selected {
    background: {color:bg-view-hover};
}

QMenu::item:selected:hover {
    background: {color:bg-view-hover};
}

QMenu::right-arrow {
    min-width: 10px;
}
QMenu::separator {
    background: {color:bg-menu-separator};
    height: 2px;
    margin-right: 5px;
}

/* Combobox */
QComboBox {
    border: 1px solid {color:border};
    border-radius: 0.2em;
    padding: 1px 3px 1px 3px;
    background: {color:bg-inputs};
}
QComboBox:hover {
    border-color: {color:border-hover};
}
QComboBox:disabled {
    background: {color:bg-inputs-disabled};
}

/* QComboBox must have explicitly set Styled delegate! */
QComboBox QAbstractItemView {
    border: 1px solid {color:border};
	background: {color:bg-inputs};
}

QComboBox QAbstractItemView::item:selected {
    background: {color:bg-view-hover};
    color: {color:font};
    padding-left: 0px;
}

QComboBox QAbstractItemView::item:selected:hover {
    background: {color:bg-view-hover};
}

QComboBox::drop-down {
    subcontrol-origin: padding;
    subcontrol-position: center right;
    width: 15px;
    border-style: none;
    border-left-style: solid;
    border-left-color: {color:border};
    border-left-width: 1px;
}
QComboBox::down-arrow, QComboBox::down-arrow:on, QComboBox::down-arrow:hover, QComboBox::down-arrow:focus
{
    image: url(:/openpype/images/combobox_arrow.png);
}

/* Splitter */
QSplitter::handle {
    border: 3px solid transparent;
}

QSplitter::handle:horizontal, QSplitter::handle:vertical, QSplitter::handle:horizontal:hover, QSplitter::handle:vertical:hover {
    /* must be single like because of Nuke*/
    background: transparent;
}

/* SLider */
QSlider::groove {
    border: 1px solid #464b54;
    border-radius: 0.3em;
    background: {color:bg-inputs};
}
QSlider::groove:horizontal {
    height: 8px;
}

QSlider::groove:vertical {
    width: 8px;
}

QSlider::groove:hover {
    border-color: {color:border-hover};
}
QSlider::groove:disabled {
    background: {color:bg-inputs-disabled};
}
QSlider::groove:focus {
    border-color: {color:border-focus};
}
QSlider::handle {
    /* must be single like because of Nuke*/
    background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5,stop: 0 {palette:blue-base},stop: 1 {palette:green-base});
    border: 1px solid #5c5c5c;
    width: 10px;
    height: 10px;

    border-radius: 5px;
}

QSlider::handle:horizontal {
    margin: -2px 0;
}
QSlider::handle:vertical {
    margin: 0 -2px;
}

QSlider::handle:disabled {
    /* must be single like because of Nuke*/
    background: qlineargradient(x1:0, y1:0,x2:1, y2:1,stop:0 {color:bg-buttons},stop:1 {color:bg-buttons-disabled});
}

/* Tab widget*/
QTabWidget::pane {
    border-top-style: none;
}

/* move to the right to not mess with borders of widget underneath */
QTabWidget::tab-bar {
    alignment: left;
}

/* avoid QTabBar overrides in Substance Painter */
QTabBar {
    text-transform: none;
    font-weight: normal;
}

QTabBar::tab {
    text-transform: none;
    font-weight: normal;
    border-top: 1px solid {color:border};
    border-left: 1px solid {color:border};
    border-right: 1px solid {color:border};
    padding: 5px;
    background: {color:tab-widget:bg};
    color: {color:tab-widget:color};
}

QTabBar::tab:selected {
    border-left-color: {color:tab-widget:bg-selected};
    border-right-color: {color:tab-widget:bg-selected};
    border-top-color: {color:border-focus};
    background: {color:tab-widget:bg-selected};
    color: {color:tab-widget:color-selected};
}

QTabBar::tab:!selected {}
QTabBar::tab:!selected:hover {
    background: {color:tab-widget:bg-hover};
    color: {color:tab-widget:color-hover};
}
QTabBar::tab:first {}
QTabBar::tab:first:selected {}
QTabBar::tab:last:!selected {
    border-right: 1px solid {color:border};
}
QTabBar::tab:last:selected {}
QTabBar::tab:only-one {}

QHeaderView {
    border: 0px solid {color:border};
    border-radius: 0px;
    margin: 0px;
    padding: 0px;
}

QHeaderView::section  {
    background: {color:bg-view-header};
    padding: 4px;
    border-top: 0px; /* Substance Painter fix */
    border-right: 1px solid {color:bg-view};
    border-radius: 0px;
    text-align: center;
    color: {color:font};
    font-weight: bold;
}
QHeaderView::section:first {
    border-left: none;
}
QHeaderView::section:last {
    border-right: none;
}
QHeaderView::section:only-one {
    border-left: none;
    border-right: none;
}

QHeaderView::down-arrow {
    image: url(:/openpype/images/down_arrow.png);
    padding-right: 4px;
    subcontrol-origin: padding;
    subcontrol-position: center right;
}

QHeaderView::up-arrow {
    image: url(:/openpype/images/up_arrow.png);
    padding-right: 4px;
    subcontrol-origin: padding;
    subcontrol-position: center right;
}

/* Checkboxes */
QCheckBox {
    background: transparent;
}

QCheckBox::indicator {
    width: 16px;
    height: 16px;
}

QAbstractItemView::indicator:checked, QCheckBox::indicator:checked {
    image: url(:/openpype/images/checkbox_checked.png);
}
QAbstractItemView::indicator:checked:focus, QCheckBox::indicator:checked:focus {
    image: url(:/openpype/images/checkbox_checked_focus.png);
}
QAbstractItemView::indicator:checked:hover, QAbstractItemView::indicator:checked:pressed, QCheckBox::indicator:checked:hover, QCheckBox::indicator:checked:pressed {
    image: url(:/openpype/images/checkbox_checked_hover.png);
}
QAbstractItemView::indicator:checked:disabled, QCheckBox::indicator:checked:disabled {
    image: url(:/openpype/images/checkbox_checked_disabled.png);
}

QAbstractItemView::indicator:unchecked, QCheckBox::indicator:unchecked {
    image: url(:/openpype/images/checkbox_unchecked.png);
}
QAbstractItemView::indicator:unchecked:focus, QCheckBox::indicator:unchecked:focus {
    image: url(:/openpype/images/checkbox_unchecked_focus.png);
}
QAbstractItemView::indicator:unchecked:hover, QAbstractItemView::indicator:unchecked:pressed, QCheckBox::indicator:unchecked:hover, QCheckBox::indicator:unchecked:pressed {
    image: url(:/openpype/images/checkbox_unchecked_hover.png);
}
QAbstractItemView::indicator:unchecked:disabled, QCheckBox::indicator:unchecked:disabled {
    image: url(:/openpype/images/checkbox_unchecked_disabled.png);
}

QAbstractItemView::indicator:indeterminate, QCheckBox::indicator:indeterminate {
    image: url(:/openpype/images/checkbox_indeterminate.png);
}
QAbstractItemView::indicator:indeterminate:focus, QCheckBox::indicator:indeterminate:focus {
    image: url(:/openpype/images/checkbox_indeterminate_focus.png);
}
QAbstractItemView::indicator:indeterminate:hover, QAbstractItemView::indicator:indeterminate:pressed, QCheckBox::indicator:indeterminate:hover, QCheckBox::indicator:indeterminate:pressed {
    image: url(:/openpype/images/checkbox_indeterminate_hover.png);
}
QAbstractItemView::indicator:indeterminate:disabled, QCheckBox::indicator:indeterminate:disabled {
    image: url(:/openpype/images/checkbox_indeterminate_disabled.png);
}

/* Views QListView QTreeView QTableView */
QAbstractItemView {
    border: 0px solid {color:border};
    border-radius: 0px;
    background: {color:bg-view};
    alternate-background-color: {color:bg-view-alternate};
    /* Mac shows selection color on branches. */
    selection-background-color: transparent;
}

QAbstractItemView::item {
    /* `border: none` hide outline of selected item. */
    border: none;
}

QAbstractItemView:disabled{
    background: {color:bg-view-disabled};
    alternate-background-color: {color:bg-view-alternate-disabled};
    border: 1px solid {color:border};
}

QAbstractItemView::item:hover {
    background: {color:bg-view-hover};
}

QAbstractItemView::item:selected {
    background: {color:bg-view-selection};
    color: {color:font-view-selection};
}

QAbstractItemView::item:selected:active {
    color: {color:font-view-selection};
}

/* Same as selected but give ability to easy change it */
QAbstractItemView::item:selected:!active {
    background: {color:bg-view-selection};
    color: {color:font-view-selection};
}

QAbstractItemView::item:selected:hover {
    background: {color:bg-view-selection-hover};
}

/* Row colors (alternate colors) are from left - right */
QAbstractItemView:branch {
    background: transparent;
}

QAbstractItemView::branch:open:has-children:!has-siblings,
QAbstractItemView::branch:open:has-children:has-siblings {
    border-image: none;
    image: url(:/openpype/images/branch_open.png);
    background: transparent;
}
QAbstractItemView::branch:open:has-children:!has-siblings:hover,
QAbstractItemView::branch:open:has-children:has-siblings:hover {
    border-image: none;
    image: url(:/openpype/images/branch_open_on.png);
    background: transparent;
}

QAbstractItemView::branch:has-children:!has-siblings:closed,
QAbstractItemView::branch:closed:has-children:has-siblings {
    border-image: none;
    image: url(:/openpype/images/branch_closed.png);
    background: transparent;
}
QAbstractItemView::branch:has-children:!has-siblings:closed:hover,
QAbstractItemView::branch:closed:has-children:has-siblings:hover {
    border-image: none;
    image: url(:/openpype/images/branch_closed_on.png);
    background: transparent;
}

QAbstractItemView::branch:has-siblings:!adjoins-item {
    border-image: none;
    image: url(:/openpype/images/transparent.png);
    background: transparent;
}

QAbstractItemView::branch:has-siblings:adjoins-item {
    border-image: none;
    image: url(:/openpype/images/transparent.png);
    background: transparent;
}

QAbstractItemView::branch:!has-children:!has-siblings:adjoins-item {
    border-image: none;
    image: url(:/openpype/images/transparent.png);
    background: transparent;
}

CompleterView {
    border: 1px solid #555555;
    background: {color:bg-inputs};
}

CompleterView::item:selected {
    background: {color:bg-view-hover};
}

CompleterView::item:selected:hover {
    background: {color:bg-view-hover};
}

CompleterView::right-arrow {
    min-width: 10px;
}
CompleterView::separator {
    background: {color:bg-menu-separator};
    height: 2px;
    margin-right: 5px;
}

/* Progress bar */
QProgressBar {
    border: 1px solid {color:border};
    font-weight: bold;
    text-align: center;
}

QProgressBar:horizontal {
    height: 20px;
}
QProgressBar:vertical {
    width: 20px;
}

QProgressBar::chunk {
    /* must be single like because of Nuke*/
    background: qlineargradient(x1: 0, y1: 0.5,x2: 1, y2: 0.5,stop: 0 {palette:blue-base},stop: 1 {palette:green-base});
}

/* Scroll bars */
QScrollBar {
    background: {color:bg-inputs};
    border-radius: 4px;
    border: 1px transparent {color:bg-inputs};
}

QScrollBar:horizontal {
    height: 15px;
    margin: 3px 3px 3px 6px;
}

QScrollBar:vertical {
    width: 15px;
    margin: 6px 3px 3px 3px;
}

QScrollBar::handle {
    background: {color:bg-scroll-handle};
    border-radius: 4px;
}

QScrollBar::handle:horizontal {
    min-width: 5px;
}

QScrollBar::handle:vertical {
    min-height: 5px;
}

QScrollBar::add-line:horizontal {
    margin: 0px 3px 0px 3px;
    width: 0px;
    height: 0px;
    subcontrol-position: right;
    subcontrol-origin: margin;
}

QScrollBar::sub-line:horizontal {
    margin: 0px 3px 0px 3px;
    height: 0px;
    width: 0px;
    subcontrol-position: left;
    subcontrol-origin: margin;
}

QScrollBar::add-line:horizontal:hover,QScrollBar::add-line:horizontal:on {
    height: 0px;
    width: 0px;
    subcontrol-position: right;
    subcontrol-origin: margin;
}

QScrollBar::sub-line:horizontal:hover, QScrollBar::sub-line:horizontal:on {
    height: 0px;
    width: 0px;
    subcontrol-position: left;
    subcontrol-origin: margin;
}

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

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

QScrollBar::sub-line:vertical {
    margin: 3px 0px 3px 0px;
    height: 0px;
    width: 0px;
    subcontrol-position: top;
    subcontrol-origin: margin;
}

QScrollBar::add-line:vertical {
    margin: 3px 0px 3px 0px;
    height: 0px;
    width: 0px;
    subcontrol-position: bottom;
    subcontrol-origin: margin;
}

QScrollBar::sub-line:vertical:hover,QScrollBar::sub-line:vertical:on {
    subcontrol-position: top;
    subcontrol-origin: margin;
}


QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on {
    subcontrol-position: bottom;
    subcontrol-origin: margin;
}

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


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