@import "./variablesLight.scss";
@import "./_mixins.scss";
@import "./_reset.scss";
@import "./_openStyle.scss";
@import "./_openLightImages.scss";

// normal, disabled, controls, hover, pressed
QAbstractSpinBox {
    color: $primaryText;
    background-color: $controlWidgetBackground;
    @include noborder;
    &:focus {
        border-color: $accentBorder;
    } 
    &:hover {
        border-color: $accentBorder;
    }
    &:disabled {
        color: $disabledText;
        border-color: $standardBorder;
    }
    &::up-button {
        background-color: transparent;
        border: 1px solid transparent;
        border-right: 3px solid transparent;

        &:disabled { //To-Do: change arrow color instead of background color
            background-color: $standardBorder;
        }
    }
    &::down-button {
        background-color: transparent;
        border: 1px solid transparent;
        border-right: 3px solid transparent;
        &:disabled { //To-Do: change arrow color instead of background color
            background-color: $standardBorder;
            //border: 1px solid $standardBorder;
        }
    }
}

// normal, disabled, hover, checked are defined
QCheckBox {
    color: $primaryText;
    background: transparent;
    &:disabled {
        color: $disabledText;
    }
    &::indicator {
        color: $primaryText;
        background-color: $controlWidgetBackground;
        @include noborder;
        &:focus {
            border-color: $accentBorder;
        } 
        &:disabled {
            background-color: $standardBorder;
        }
        &:hover {
            @include borderhover;
        }
    }
}

// normal, disabled, hover, pressed, controls are defined
QComboBox {
    color: $primaryText;
    background-color: $controlWidgetBackground;
    @include noborder;
    selection-background-color: $selectedElement;
    &:focus {
        border-color: $accentBorder;
    } 
    &:disabled {
        color: $disabledText;
    }
    &:hover {
        border-color: $accentBorder;
        background-color: $accentBorder;
    }
    &::drop-down {
        background-color: transparent;
        border: 2px solid transparent;
        border-right: 5px solid transparent;
        &:disabled { //To-Do: change arrow color instead of background color
            background-color: $standardBorder;
        }
    }
}

// non-interactive element
QDockWidget {
    color: $primaryText;
    background: $primaryBackground;
    @include hardborder;
}

// non-interactive element
QDialog {
    color: $primaryText;
    background-color: $primaryBackground;
    @include noborder;
}

// non-interactive element
QGroupBox {
    color: $primaryText;
    border-top: 3px solid $contrastBorder;
    &::indicator {
        border: 1px solid $contrastBorder;
        background-color: $secondaryBackground;
    }
}

// needs refinement applied to property view, spreadsheet etc.
QHeaderView::section {
    color: $primaryText;
    background-color: $standardBorder;
    border-left: 1px solid $secondaryBackground;
    border-right: 1px solid $secondaryBackground;
}

// non-interactive element
QLabel {
    color: $primaryText;
    background-color: transparent;
    &[haslink="true"] {
        color: $link;
    }
    &:disabled {
        color: $disabledText;
    }
}

// normal, disabled, hover, focus
QLineEdit {
    color: $primaryText;
    background-color: $controlWidgetBackground;
    @include noborder;
    &:focus {
        border-color: $accentBorder;
    } 
    &:disabled {
        color: $disabledText;
    }
    &:hover {
        @include borderhover;
    }
    &:focus {
        @include borderhover;
    }
}

QList {
    font-weight:500;
    background-color: $controlWidgetBackground;
    border-radius: 2px;
    border: 1px solid transparent;
    &::item {
        border-radius: 2px;
        border: 1px solid transparent;
    }
    &::item:selected {
        background-color: $accentBackground;
        border: 1px solid $accentBorder;
    }
    &::item:hover {
        background-color: $selectedElement;
        border: 1px solid $accentBorder;
        border-radius: 2px;
    }
    &::indicator {
        background-color: transparent;
        border: 1px solid $contrastBorder;
        border-radius: 2px;
        &:disabled {
            border: 1px solid $standardBorder;
            border-radius: 2px
        }
    }
}

QListView {
    color: $primaryText;
    background-color: $secondaryBackground;
    alternate-background-color: $secondaryBackground;
}

QMainWindow {
    &::separator {
        border: 0px solid transparent;
        background-color: $standardBorder;
        &:hover {
            color: $inverseText;
            background-color: $accentBackground;
        }
    }
}

//finished
QMenu {
    background-color: $secondaryBackground;
    @include softborder;
    &::item {
        background-color: $secondaryBackground;
        color: $primaryText;
        @include noborder;
        border-radius: 0px;
    }
    &::item:disabled {
        color: $disabledText;
    }
    &::item:selected {
        //color: $inverseText;
        @include borderhover;
        background-color: $primaryBackground;
    }
    &::item:pressed {
        color: $inverseText;
        @include borderhover;
        background-color: $accentBackground;
    }
    &::indicator {
        border: 1px solid $contrastBorder;
    }
    &::separator {
        background-color: $standardBorder;
    }
}

QMenuBar {
    color: $secondaryText;
    background-color: $secondaryBackground;
    border-bottom: 1px solid $standardBorder;
    &::item {
        @include noborder;
    }

    &::item:pressed {
        color: $inverseText;
        background-color: $accentBackground;
        @include borderhover;
    }

    &::item:selected {
        color: $inverseText;
        background-color: $accentBackground;
        @include borderhover;
    }
}

QProgressBar,
QProgressBar:horizontal {
    color: $primaryText;
    min-height: 24px;
    background-color: transparent;
    text-align: center;
    border: 1px solid $contrastBorder;
    &::chunk {
        background-color: $accentBorder;
    }
}

QPushButton {
    color: $primaryText;
    border: 1px solid $contrastBorder;
    background-color: $controlWidgetBackground;
    &:hover {
        border:1px solid $accentBorder;
        background-color: $standardBorder;
    }
    &:focus {
        border:1px solid $accentBorder;
        background-color: $standardBorder;
    }
    &:disabled {
        color: $disabledText;
        background-color: $standardBorder;
    }
    &:pressed {
        color: $inverseText;
        background-color: $accentBackground;
    }
}

QRadioButton {
    color: $primaryText;
    &:disabled {
        color: $disabledText;
    }
    &::indicator {
        margin: 2px;
        border: 1px solid $contrastBorder;
        background-color: $secondaryBackground;
        &:focus {
            border-color: $accentBorder;
        } 
        &:disabled {
            border-color: $standardBorder;
        }
    }
}

QScrollBar {
    background-color: $secondaryBackground;
    &::handle {
        background-color: $contrastBorder;
        border: 1px solid transparent;

        &:hover {
            background-color: $accentBorder;
            border: 1px solid $accentBorder
        }
    }
}

QSizeGrip {
    background: transparent;
}

QStatusBar {
    color: $secondaryText;
}

QSpinBox {
    @extend QAbstractSpinBox;
}

QTabBar {
    &::tab {
        color: $primaryText;
        background-color: $secondaryBackground;
        border: 0;
        border-left: 5px solid $contrastBorder;
        border-radius: 0;
        &:hover {
            background-color: $accentBackground; //$standardBorder;
            border-color: $accentBorder;
        }
        &:selected {
            color: $inverseText;
            background-color: $selectedElement; //$selectedElement;
            border-color: $activated;
        }
    }
}

QTabBar QToolButton { /* the scroll buttons are tool buttons */
    color: $primaryText;
    border: 1px solid $contrastBorder;
}

QTableWidget {
    background-color: $secondaryBackground;
    alternate-background-color: $secondaryBackground;
    gridline-color: $contrastBorder;
}

QTableView {
    color:$primaryText;  /*Text in focused cell*/
    @extend QTableWidget;
    &::item {
        &:selected {
            background-color: $accentBorder;
        }
        &:indeterminate {
            background-color: #ff00ff;
        }
    }
}

QTreeView {
    background-color: $primaryBackground;
    alternate-background-color: $primaryBackground;
    @include noborder;
    selection-color: $inverseText;
    selection-background-color: $accentBackground;
    &:enabled {
        color: $primaryText
    }
    &:disabled {
        color: $disabledText;
    }
    &::item:selected {
        color: $inverseText;
        background-color: $selectedElement;
        border: 1px solid $accentBorder;
    }
}

QTreeView::branch  {
    background: transparent;
}

QTextEdit {
    color:$primaryText;
    background-color: $secondaryBackground;
    @include noborder;
    &:disabled {
        color: $disabledText;
        border-color: $standardBorder;
    }
}

QPlainTextEdit {
    @extend QTextEdit;
}

QToolBar {
    background-color: $primaryBackground;
    border-bottom: 1px solid $standardBorder;
    &::separator {
        background-color: $contrastBorder;
    }
}

QToolBarExtension {
    border: 1px solid transparent;
    background-color: transparent;
}

QToolButton {
    @include noborder;
    color: $primaryText;
    background-color: transparent;
    &:hover {
        background-color: $controlWidgetBackground;
        border: 1px solid $accentBorder
    }
    &:focus {
        border: 1px solid $accentBorder;
    }
    &:pressed {
        color: $inverseText;
        border: 1px solid $accentBorder;
        background-color: $accentBackground;
    }
    &:checked {
        color: $inverseText;
        background-color: $selectedElement;
        border: 1px solid $accentBorder;
    }
    &::menu-button {
        width: 14px;
        height: 14px;
        border-bottom: 0px solid #ffffff;
    }
    &::menu-arrow {
        background: transparent;
    }
}

QToolTip {
    color: $inverseText;
    @include borderhover;
    background-color: $tooltipBackground;
}

// Specialty styling
QDialog QTreeWidget {
    color: $primaryText;
    background-color: $secondaryBackground;
}

QFileDialog {
    color: $primaryText;
}

QWidget#wbList * {
    background-color: transparent;
}

QWidget#wbList QPushButton {
    @extend QPushButton;
}

/*==================================================================================================
Tasks panel (custom FreeCAD class)
==================================================================================================*/
/* Action group */
QFrame[class="panel"] {
    background-color: transparent; /* temporal (transparent background) */
}

/* Panel header */
QSint--ActionGroup QFrame[class="header"] {
    border-bottom: 3px solid $contrastBorder;
    background-color: transparent;
    border-radius: 0;
}

QSint--ActionGroup QFrame[class="header"]:hover {
    background-color: $standardBorder;
    border-bottom: 3px solid $accentBorder;
}

QSint--ActionGroup QToolButton[class="header"] {
    color: $primaryText; /* Task Panel Header text color */
}

QSint--ActionGroup QFrame[class="header"] QLabel {
    background-color: transparent;
}

QSint--ActionGroup QFrame[class="header"] QLabel[fold="true"] {
    background-color: transparent;
}

QSint--ActionGroup QFrame[class="content"] QTreeView QAbstractSpinBox {
    border: 0px solid transparent;
}

Gui--PropertyEditor--PropertyEditor {
    gridline-color: $contrastBorder;
    qproperty-groupBackground: $controlWidgetBackground;
}

/* Cells with values that can only be changed with "..." button (Attachment)
/* These seem to draw on top of the underlying label, so must be completely hidden or have an opaque background */
Gui--PropertyEditor--PropertyEditor > QWidget > QWidget > QLabel {
	background-color: $primaryBackground;
}

Gui--OverlayToolButton {
    background-color: transparent;
    border: 0px solid transparent;
        &:hover {
            background-color: transparent;
            border: 0px solid transparent;
        }
        &:pressed {
            background-color: transparent;
            border: 0px solid transparent;
        }
}

Gui--OverlayTitleBar {
    color: $secondaryText;
}

QSint--ActionGroup QFrame[class="content"] QToolButton {
    @extend QPushButton;
}

Gui--NotificationLabel {
    background-color: $secondaryBackground;
    @include softborder;
}

QTabWidget#TabBar > QTabBar {
    border: 0px solid transparent;
    background-color: transparent;
}

QWidget#Tabs {
    background-color: transparent;
    border: 0px solid transparent;
}

QWidget#Selector{
    border-bottom: 1px solid transparent;
}

QWidget#Selector > QToolButton {
    @extend QToolButton;
    font-weight: 500;
    background-color: $controlWidgetBackground;
    border: 1px solid $contrastBorder;
    border-radius: 4px;
    &:hover {
        background-color: $accentBackground;
        border: 1px solid $accentBorder;
    }
    &:selected {
        background-color: $accentBackground;
        border: 1px solid $accentBorder;
    }
}

QDialog#Gui__Dialog__DlgPreferences QTreeView#groupsTreeView {
    selection-background-color: $accentBackground;

    &::item:selected {
        background-color: $accentBackground;
    }
}

QToolButton#ScrollLeftButton,
QToolButton#ScrollRightButton {
    background-color: $secondaryBackground;
}

QToolBox {
  background-color: transparent;
  color: $inverseText;
}

QToolBox::tab {
  color: $inverseText;
}

QToolBox::tab:disabled {
  color: $secondaryText;
}

QToolBox::tab:selected {
  color: $inverseText;
}

QToolBox::tab:selected:disabled {
  color: $secondaryText;
}

QToolBox::tab:!selected {
  color: $inverseText;
}
