$selected-color: rgb(0, 174, 75);
$scrollbar-border-radius: 15px;
$default-element-border: $element-border solid $border;
// variables for the picture view in the maker
$picture-view-border-color: $primary;
$picture-view-border-size: $element-border;
$picture-view-active-color: $secondary;

// For generic classes
*[cssClass~='header-underline'] {
  color: $neutral;
  border-bottom: 1px solid;
  border-color: $neutral;
  margin-bottom: 5px;
  padding-left: 10px;
  padding-right: 10px;
}

*[cssClass~='bold'] {
  font-weight: bold;
}

*[cssClass~='hand-separator'] {
  color: $neutral;
}

*[cssClass~='neutral'] {
  color: $neutral;
}

*[cssClass~='lr-padding'] {
  padding-left: 10px;
  padding-right: 10px;
}

*[cssClass~='center'] {
  text-align: center;
}

*[cssClass~='right'] {
  text-align: right;
}

*[cssClass~='mr'] {
  margin-right: 10px;
}

*[cssClass~='ml'] {
  margin-left: 10px;
}

*[cssClass~='mt'] {
  margin-top: 5px;
}

*[cssClass~='mb'] {
  margin-bottom: 5px;
}

*[cssClass~='cocktail-picture-view'] {
  border-radius: 0px;
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
  border-bottom: $picture_view_border_size solid $picture-view-border-color;
  border-top: 0px;
  border-left: $picture_view_border_size solid $picture-view-border-color;
  border-right: $picture_view_border_size solid $picture-view-border-color;
}

*[cssClass~='cocktail-picture'] {
  border-radius: 3px;
  border: 2px solid $neutral;
}

// specific classes
// Information dialog
#informationLabel {
  padding: 5px 25px 5px 25px;
}

#virgin_checkbox,
*[cssClass~='big-checkbox'] {
  &.QCheckBox::indicator {
    width: 30px;
    height: 30px;
    margin-right: 10px;
    margin-left: 5px;
  }
}

// Other Elements
QCheckBox::indicator,
QTableView::indicator {
  width: 18px;
  height: 18px;
  border: 2px solid;
  border-radius: 3px;
  &:unchecked {
    border-color: $border;
  }
  &:disabled {
    border-color: $background;
  }
  &:checked {
    image: url(./src/ui_elements/check.png);
    border-color: $selected-color;
  }
}

QWidget {
  color: $primary;
  background-color: $background;
  &:item:selected {
    color: $secondary;
    font-weight: bold;
    border: 3px solid $secondary;
    border-radius: 3px;
  }
  &[cssClass~='secondary'] {
    color: $secondary;
  }
  &[cssClass~='left-shift'] {
    margin: 5px 0px 5px 20px;
  }
  &[cssClass~='right-shift'] {
    margin: 5px 20px 5px 0px;
  }
  &:disabled {
    text-decoration: line-through;
  }
}

QTabWidget::pane {
  border: 1px solid $border;
  top: 1px;
}

QTabBar::tab {
  background-color: $border;
  font-weight: bold;
  color: $tabborder;
  border-width: 1px;
  border-color: $tabborder;
  border-style: solid;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  padding: 5px 0px 5px 0px;
  width: 150px;
  &:selected {
    color: $tabborder;
    background-color: $primary;
  }
  &:disabled {
    text-decoration: line-through;
  }
}

.QSlider {
  min-height: 30px;
  max-height: 50px;
  &::groove:horizontal {
    border: 1px solid;
    height: 5px;
    background: $border;
    margin: 0 12px;
  }
  &::handle:horizontal {
    background: $primary;
    border-radius: $scrollbar-border-radius;
    width: 40px;
    height: 30px;
    margin: -24px -12px;
    &:pressed {
      background: $secondary;
    }
  }
}

QPushButton {
  background-color: $background;
  color: $primary;
  border: 3px solid $primary;
  border-radius: 7px;
  padding: 3px;
  padding-left: 5px;
  padding-right: 5px;
  font-weight: bold;
  &:checked,
  &:pressed {
    color: $secondary;
    border-color: $secondary;
  }
  /* Inverted */
  &[cssClass~='btn-inverted'] {
    background-color: $primary;
    color: $background;
    &:checked,
    &:pressed {
      background-color: $secondary;
      border-color: $secondary;
    }
    &[cssClass~='destructive'] {
      background-color: $destructive;
      color: $background;
      &:pressed {
        background-color: $destructive;
        border-color: $destructive;
      }
    }
    &[cssClass~='neutral'] {
      background-color: $neutral;
      color: $background;
      &:pressed {
        background-color: $neutral;
        border-color: $neutral;
      }
    }
    &[cssClass~='btn-half-top'] {
      background-color: $picture-view-border-color;
      color: $background;
      border: $picture_view_border_size solid $picture-view-border-color;
      border-radius: 0px;
      border-top-left-radius: 7px;
      border-top-right-radius: 7px;
      border-bottom: 0px;
      &:pressed {
        color: $background;
        background-color: $picture-view-active-color;
        border-color: $picture-view-active-color;
      }
    }
  }
  &[cssClass~='no-border'] {
    border-width: 0;
    padding: 1px;
    padding-left: 1px;
    padding-right: 1px;
  }
  &[cssClass~='round'] {
    border-radius: 20px;
  }
  &[cssClass~='round-sm'] {
    border-radius: 12px;
  }
  &[cssClass~='secondary'] {
    color: $secondary;
    border-color: $secondary;
    &:pressed {
      color: $primary;
      border-color: $primary;
    }
  }
  &[cssClass~='destructive'] {
    color: $destructive;
    border-color: $destructive;
    &:pressed {
      color: $destructive;
      border-color: $destructive;
    }
  }
  &[cssClass~='neutral'] {
    color: $neutral;
    border-color: $neutral;
    &:pressed {
      color: $neutral;
      border-color: $neutral;
    }
  }
  /* for teams */
  &[cssClass~='btn-teamone'] {
    background-color: $teamone;
    border-color: $teamone;
    color: $background;
  }
  &[cssClass~='btn-teamtwo'] {
    background-color: $teamtwo;
    border-color: $teamtwo;
    color: $background;
  }
  &[cssClass~='btn-half-top'] {
    border: $picture_view_border_size solid $picture-view-border-color;
    color: $picture-view-border-color;
    border-radius: 0px;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    border-bottom: 0px;
    &:pressed {
      color: $picture-view-active-color;
      border-color: $picture-view-active-color;
    }
  }
}

QFileDialog {
  QPushButton {
    font-size: 24px;
    font-weight: bold;
  }
  & QHeaderView {
    &::section {
      background-color: $background;
    }
  }
  & QTableCornerButton::section {
    background: $background;
  }
  & QListView,
  QTreeView {
    font-size: 20px;
  }
}

QProgressBar {
  background-color: $progressbg;
  color: $background;
  border: 2px $progressbg;
  border-radius: 5px;
  text-align: center;
  min-height: 38px;
  &::chunk {
    border: 2px $progressbg;
    border-radius: 5px;
    background-color: $progressbar;
  }
  &[cssClass~='no-bg'] {
    background-color: $background;
  }
}

QComboBox {
  color: $primary;
  border: $default-element-border;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
  padding: 1px 18px 1px 5px;
  min-width: 6em;
  &:on {
    /* shift the text when the popup opens */
    border: $default-element-border;
    border-top-left-radius: 7px;
    border-bottom-left-radius: 0px;
    color: $secondary;
  }
  & QAbstractItemView {
    border: $default-element-border;
  }
}

QLineEdit {
  padding: 1px;
  border-style: solid;
  border: $default-element-border;
  border-radius: 5;
}

QListWidget {
  border: $default-element-border;
  border-bottom-right-radius: $scrollbar-border-radius + 6px;
  border-top-right-radius: $scrollbar-border-radius + 6px;
  & QScrollBar:vertical {
    border-right: 0px solid $border;
  }
  & QScrollBar:horizontal {
    border-bottom: 0px solid $border;
  }
}

QScrollArea QScrollBar:vertical {
  border-right: $default-element-border;
}

QScrollArea QScrollBar:horizontal {
  border-bottom: $default-element-border;
}

/* Moving List Widget here from the single objects */
QScrollBar:vertical {
  border: $default-element-border;
  border-right: 1px solid $border;
  border-radius: $scrollbar-border-radius;
  background: $background;
  width: 40px;
  margin: 25px 0px 25px 0px;
}

QScrollBar:horizontal {
  border: $default-element-border;
  border-bottom: 1px solid $border;
  border-radius: $scrollbar-border-radius;
  background: $background;
  height: 40px;
  margin: 0px 25px 0px 25px;
}

QScrollBar::handle {
  &:vertical,
  &:horizontal {
    background: $primary;
    border-radius: $scrollbar-border-radius - 5px;
    &:pressed {
      background-color: $secondary;
      border-color: $secondary;
    }
  }
}

// bottom button
QScrollBar::add-line:vertical {
  border: $default-element-border;
  border-bottom-left-radius: $scrollbar-border-radius;
  border-bottom-right-radius: $scrollbar-border-radius;
  background-color: $border;
  height: 38px;
  subcontrol-position: bottom;
  subcontrol-origin: margin;
}

QScrollBar::add-line:horizontal {
  border: $default-element-border;
  border-top-right-radius: $scrollbar-border-radius;
  border-bottom-right-radius: $scrollbar-border-radius;
  background-color: $border;
  width: 38px;
  subcontrol-position: right;
  subcontrol-origin: margin;
}

// top button
QScrollBar::sub-line:vertical {
  border: $default-element-border;
  border-top-left-radius: $scrollbar-border-radius;
  border-top-right-radius: $scrollbar-border-radius;
  background-color: $border;
  height: 38px;
  subcontrol-position: top;
  subcontrol-origin: margin;
}

QScrollBar::sub-line:horizontal {
  border: $default-element-border;
  border-top-left-radius: $scrollbar-border-radius;
  border-bottom-left-radius: $scrollbar-border-radius;
  background-color: $border;
  width: 38px;
  subcontrol-position: left;
  subcontrol-origin: margin;
}

// remove the grid thingy from bg
QScrollBar::add-page:vertical,
QScrollBar::sub-page:vertical,
QScrollBar::add-page:horizontal,
QScrollBar::sub-page:horizontal {
  background: none;
}

QScrollBar::sub-line:vertical:pressed,
QScrollBar::add-line:vertical:pressed,
QScrollBar::sub-line:horizontal:pressed,
QScrollBar::add-line:horizontal:pressed {
  background-color: $secondary;
  border-color: $secondary;
}

/* Message box from system */
.QMessageBox {
  font-size: 16pt;
}

QMessageBox {
  background-color: $background;
  font-size: 16pt;
  & QPushButton {
    background-color: $primary;
    color: $background;
    font-size: 30pt;
    padding: 5px 20px 5px 20px;
    min-width: 120px;
  }
  & QLabel {
    color: $primary;
  }
}

QDateEdit,
QTimeEdit {
  border: $default-element-border;
  border-radius: 7px;
  border-top-right-radius: 20px;
  border-bottom-right-radius: 20px;

  &::down-button,
  &::up-button {
    width: 100px;
    border: 3px solid $background;
    background-color: $primary;
    &:pressed {
      background-color: $secondary;
    }
  }
  &::down-button {
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
  }
  &::up-button {
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
  }
  // &::drop-down {
  //   width: 50px;
  //   border: 1px solid rgb(242, 0, 0);
  //   border-left-width: 0;
  // }
}

QHeaderView {
  &::section {
    background-color: $background;
  }
}

QTableView {
  & QTableCornerButton::section {
    background: $background;
  }
  &::item {
    margin-left: 20px;
    padding: 10px 0px 15px 0px;
    border-bottom: 1px solid $primary;
  }
  &::indicator {
    width: 35px;
    height: 35px;
    margin-right: 15px;
  }
}
