@use "../../../../public/shared.module.scss";

// TODO: Use correct variables when available
$scrollbarThumbBorderColor: #ffffff;
$scrollbarTrackBackgroundColor: transparent;
$sectionContainerColor: #4e5b61;
$sectionHeaderBorderColor: #c9d2d2;

$themeBackgroundColor: #ffffff;
$themeColor: #000000;
$themeAutoBorderColor: #c9d2d2;
$themeAutoLabelColor: #7f8c8d;
$themeRadioInput: #008184;

$fontSizeBackgroundColor: #ffffff;
$fontSizeColor: #434f54;
$fontSizeBorderColor: #c9d2d2;

$savingColor: #000000;
$verifyAndUploadColor: #000000;
$consoleVerbosityButtonColor: #008184;
$consoleVerbosityColor: #7f8c8d;

.version {
  display: grid;
  justify-content: end;
  padding: 6px;
}

.opt-out {
  padding: 12px;
  border-radius: 6px;
  background: #B3E0E2;
}

.settings-container {
  overflow: auto;
  display: grid;
  padding: 0 4px 0 20px;
  grid-auto-flow: row;
  gap: 36px;

  &::-webkit-scrollbar-thumb {
    border: 4px solid $scrollbarThumbBorderColor;
  }

  &::-webkit-scrollbar-track {
    background-color: $scrollbarTrackBackgroundColor;
  }
}

.section-container {
  display: grid;
  grid-auto-flow: row;
  grid-template-rows: 24px 1fr;
  gap: 12px;
  color: $sectionContainerColor;
}

.section-header {
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: fit-content(100%) auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid $sectionHeaderBorderColor;
}

.section {
  display: grid;
  grid-auto-flow: row;
  gap: 20px;
}

.setting {
  display: grid;
  grid-auto-flow: row;
  grid-template-rows: 24px 1fr;
  gap: 12px;
}

.setting__theme {
  display: grid;
  padding: 16px 12px 12px 12px;
  grid-auto-flow: row;
  gap: 12px;
  border-radius: 6px;
  background-color: $themeBackgroundColor;
  color: $themeColor;
}

.setting__theme-buttons {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 12px;
}

.setting__theme-radio-group {
  display: grid;
  grid-auto-flow: column;
  justify-content: space-around;
}

.setting__theme-radio-container {
  display: grid;
  row-gap: 16px;
  align-items: center;
  justify-items: center;

  // TODO: Remove when dark theme is available
  &.hidden {
    row-gap: 8px;
    pointer-events: none;

    & > :nth-child(1),
    & > :nth-child(2),
    & > :nth-child(3) {
      opacity: 0.5;
    }
  
    & > :nth-child(4) {
      grid-column: 1 / 3;
      grid-row: 2 / 3;
      background-color: #7FCBCD;
      border-radius: 4px;
      padding: 0 4px;
    }
  }

  & > :nth-child(1) {
    grid-column: 1 / 2;
    grid-row: 3 / 4; // TODO: Change with grid-row: 2 / 3; when dark theme is available
  }

  & > :nth-child(2) {
    grid-column: 2 / 3;
    grid-row: 3 / 4; // TODO: Change with grid-row: 2 / 3; when dark theme is available
  }

  & > :nth-child(3) {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
  }
}

.setting__theme-radio-button {
  display: grid;
  align-items: center;
}

.setting__theme-radio-input {
  width: 18px;
  height: 18px;
  margin: unset;
  accent-color: $themeRadioInput;
}

.setting__theme-auto {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  border-top: 1px solid $themeAutoBorderColor;
  padding-top: 12px;
  gap: 16px;
  
  &.hidden {
    display: none;
  }
}

.setting__theme-auto-label {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  
  & :nth-child(2) {
    color: $themeAutoLabelColor;
  }
}

.setting__font-size {
  height: 40px;
  display: grid;
  grid-auto-flow: column;
  gap: 12px;
  grid-auto-columns: 30px 1fr 30px;
  align-items: center;
}

.setting__font-size-button {
  display: grid;
  align-items: center;

  & svg {
    width: 30px;
    height: 30px;
  }
}

.setting__font-size-input {
  display: grid;
  padding: 0;
  justify-content: center;
  align-items: center;
  gap: 4px;
  text-align: center;
  height: 36px;

  border-radius: 3px;
  border: 1px solid $fontSizeBorderColor;
  background: $fontSizeBackgroundColor;
  color: $fontSizeColor;
}

.setting__device-selection,
.setting__saving {
  display: grid;
  grid-auto-flow: row;
  gap: 12px;
  grid-template-columns: repeat(1, auto fit-content(100%));
  align-items: center;
  justify-items: stretch;
  color: $savingColor;
}

.setting__device-selection-toggle-button,
.setting__saving-toggle-button {
  border: none;
  width: 37px;
  height: 20px;
  box-sizing: unset;
  padding: unset;
}

.setting__verify-and-upload {
  display: grid;
  grid-auto-flow: row;
  align-items: center;
  gap: 12px;
  color: $verifyAndUploadColor;
}

.setting__console-verbosity {
  display: grid;
  row-gap: 12px;
}

.setting__console-verbosity-radio-container {
  display: grid;
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
  gap: 8px;
}

.setting__console-verbosity-radio-input {
  width: 18px;
  height: 18px;
  margin: unset;
  accent-color: $consoleVerbosityButtonColor;
}

.setting__device-selection-info,
.setting__console-verbosity-info {
  color: $consoleVerbosityColor;
}
