::-webkit-scrollbar-track:hover {
  background: var(--theme-input-background);
}

.noSelect {
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.italic {
  font-style: italic;
}

form label {
  float: left;
  padding: 3px;
  margin: 5px;
}

form input {
  float: right;
}

input, select {
  padding: 1px;
  margin: 5px;
  border: 1px solid var(--theme-border);
  background-color: var(--theme-input-background);
  color: var(--theme-primary);
}

hr {
  color: var(--theme-hr-color);
  border-color: var(--theme-hr-color);
}

#siteTitle {
  /* To get around margin issues with a 100vh linear gradient background */
  margin-top: 0;
  padding-top: 20px;
}

.formInput {
  padding: 5px;
  overflow: auto;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.flexKeepRight {
  flex-direction: row-reverse;
}

.customCheckboxContainer {
  display: inline-block;
  margin: auto 3px auto 3px;
  height: 13px;
  width: 13px;
}

.customCheckboxInnerContainer {
  display: block;
  position: relative;
}

.customCheckboxInnerContainer input[type=checkbox] {
  position: absolute;
  opacity: 0;
  height: 0;
  width: 0;
}

.customCheckbox {
  position: absolute;
  top: 0;
  left: 0;
  height: 13px;
  width: 13px;
  border-radius: 4px;
  background-color: var(--custom-checkbox-background);
  border: 1px solid #53575a;
}

.customCheckboxInnerContainer input[type=checkbox]:disabled ~ .customCheckbox {
  opacity: 0.5;
}

.customCheckboxInnerContainer input[type=checkbox]:hover:not(:disabled) ~ .customCheckbox {
  background-color: var(--custom-checkbox-hover);
  border-color: #af4f00;
}

.customCheckboxInnerContainer input[type=checkbox]:checked ~ .customCheckbox {
  background-color: var(--custom-checkbox-checked);
}

.customCheckboxInnerContainer input[type=checkbox]:checked:hover:not(:disabled) ~ .customCheckbox {
  background-color: var(--custom-checkbox-checked-hover);
}

.customCheckboxInnerContainer input[type=checkbox]:focus ~ .customCheckbox {
  border-color: var(--theme-focus-color);
}

.customCheckbox:after {
  content: "";
  position: absolute;
  display: none;
}

.customCheckboxInnerContainer input[type=checkbox]:checked ~ .customCheckbox:after {
  display: block;
}

.customCheckboxInnerContainer input[type=checkbox]:checked:hover:not(:disabled) ~ .customCheckbox:after {
  border-color: var(--custom-checkbox-checked-hover-check);
}

.customCheckboxInnerContainer input[type=checkbox]:hover:not(:checked):not(:disabled) ~ .customCheckbox:after {
  display: block;
  opacity: 0.4;
  border-color: var(--custom-checkbox-checked);
}

.customCheckboxInnerContainer .customCheckbox:after {
  left: 4px;
  top: 2px;
  width: 3px;
  height: 6px;
  border: solid var(--custom-checkbox-checked-check);
  border-width: 0 2px 2px 0;
  -webkit-transform: rotate(40deg);
  -ms-transform: rotate(40deg);
  transform: rotate(40deg);
}

.instructions {
  padding: 0 10px 0 10px;
}

.inlineButtonHolder {
  display: block;
  margin: auto;
  text-align: center;
}

.inlineButton {
  margin-top: 10px;
  width: 335px;
  border-radius: 5px;
  padding: 1px 5px 1px 5px;
  background: transparent;
  border-color: var(--theme-border);
}

.fancySelect:hover,
#search:hover,
.inlineButton:hover {
  border-color: var(--theme-border-hover);
}

.fancySelect option {
  background-color: var(--theme-background);
}

.fancySelect option:hover {
  background-color: var(--theme-input-background);
}

select:focus,
input:focus {
  border-color: var(--theme-focus-color) !important;
}

#bulkActionCustomizeTable input[type=checkbox]:focus {
  outline: 1px solid var(--theme-focus-color);
}

input:focus-visible {
  outline: none;
}

#searchContainer {
  padding-top: 10px;
  width: 100%;
  text-align: center;
}

#search {
  width: 325px;
  margin: auto;
}

#toplevellist,
#seasonlist,
#episodelist {
  max-width: 1000px;
  margin: auto;
}

/* ButtonCreator buttons */
.button {
  padding: 0 3px 0 3px;
  display: inline-block;
  line-height: 20px;
  cursor: default;
}

.button:hover:not(.disabled) {
  transition: border .25s,box-shadow .5s;
}

.button.disabled {
  opacity: 0.5;
}

.button:hover:not(.disabled) {
  border: 1px solid var(--button-disabled-border);
  box-shadow: 0 0 6px var(--button-disabled-shadow);
}

.button:focus-visible {
  outline: var(--theme-focus-color) solid 1px;
  border-radius: 3px;
}

.button>svg {
  vertical-align: middle;
}

.buttonTextOnly {
  margin: 3px 1px 3px 1px;
  font-size: 10pt;
  border: 1px solid var(--text-button-border);
}

.buttonTextOnly>span {
  padding-left: 5px;
  padding-right: 5px;
}

.buttonIconAndText, .buttonIconOnly {
  border: 1px solid transparent;
  font-size: 9pt;
}

.buttonIconAndText>svg, .buttonIconOnly>svg {
  opacity: 0.8;
}

.buttonIconAndText:hover:not(.disabled)>svg,
.buttonIconOnly:hover:not(.disabled)>svg {
  opacity: 1;
}

.selected .buttonIconAndText,
.bulkResultRow .buttonTextOnly {
  margin: 0;
}

.buttonIconAndText>span {
  margin-left: 5px;
  vertical-align: middle;
}
/* End ButtonCreator buttons */

.topLevelResult,
.seasonResult,
.baseItemResult,
.bulkResultRow,
.sectionOptionsResultRow {
  display: flex;
}

.topLevelResult,
.seasonResult,
.baseItemResult {
  display: flex;
  cursor: pointer;
}

.topLevelResult,
.seasonResult,
.bulkResultRow,
.sectionOptionsResultRow {
  justify-content: center;
}

.topLevelResult {
  padding: 10px;
}

.topLevelResult,
.seasonResult,
.sectionOptionsResultRow {
  border-bottom: 1px solid var(--theme-hr-color);
}

.topLevelResult:hover,
.seasonResult:hover,
.baseItemResult:hover,
.bulkResultRow:hover {
  font-weight: bold;
  background-color: var(--media-item-hover);
}

.sectionOptionsResultRow {
  font-weight: bold;
  background-color: var(--section-options-background);
}

.sectionOptionsResultRow:hover {
  background-color: var(--section-options-hover);
}

.topLevelResult>div,
.bulkResultRow>div,
.sectionOptionsResultRow>div {
  flex: 1;
}

.sectionOptionsResultRow>.bulkActionTitle {
  flex: 0 1 fit-content;
}

.showResultSeasons {
  text-align: center;
}

.showResultEpisodes {
  text-align: right;
}

.resultTitle,
.selected.showResult>.resultTitle,
.seasonResult>.selectedSeasonTitle {
  flex: 1 3 fit-content;
}

.selected.showResult>.resultTitle {
  margin-right: 10px;
}

/* Allow show names to take up 50% of the space, allocating 25% for season counts and marker info. */
.showResult:not(.selected)>.resultTitle {
  flex: 1 1 50%;
}

.seasonResult {
  padding: 10px 10px 10px 20px;
}

/* Always keep marker info on a single row, wrapping long season titles to a new row. */
.seasonResult:not(.selected)>.showResultEpisodes {
  flex: 0 0 fit-content;
}

/* Make back buttons/marker info a fixed width to allow show/season titles to grow. */
.showResult.selected>.showResultEpisodes {
  flex: 0 2 fit-content;
}

.showResult.selected>.showResultSeasons {
  flex: 1 2 fit-content;
}

.seasonResult.selected>.showResultEpisodes {
  flex: 0 2 fit-content;
}

.showResult.selected>.goBack,
.seasonResult.selected>.goBack {
  flex: 0 3 calc(max(20%, 140px));
}

/* Standard marker table */
.markerTable {
  & thead {
    border-bottom: 1px solid var(--theme-primary);
  }

  & tr:nth-child(odd) {
    background-color: var(--table-odd-row);
  }

  & tr:nth-child(odd):hover {
    background-color: var(--table-odd-hover);
  }

  & tr:nth-child(even) {
    background-color: var(--table-even-row);
  }

  & tr:nth-child(even):hover {
    background-color: var(--table-even-row-hover);
  }
}

/* Allow bulk action buttons to grow */
.bulkResultRow>.goBack {
  flex: 0 1 auto;
}

.bulkResultRow {
  padding: 5px 10px 5px 20px;
}

.sectionOptionsResultRow {
  padding: 10px 10px 10px 20px;
  line-height: 23px;
}

.bulkActionTitle {
  vertical-align: middle;
}

.seasonResult>div {
  flex: 1;
}

.baseItemResult {
  padding: 5px 10px 5px 10px;
  justify-content: space-between;
}

.episodeName, .movieName {
  padding-left: 10px;
}

.episodeSeparator {
  margin: 1px;
}

.expandIcon {
  height: 12px;
  margin-right: 5px;
  vertical-align: baseline;
  transition: transform 0.15s;
}

.expandIcon.collapsed {
  transform: rotate(-90deg);
  transition: transform 0.15s;
}

.goBack {
  text-align: right;
  line-height: 20px;
}

.goBack>input {
  margin: 0;
  padding: 2px;
}

.goBack>.buttonTextOnly {
  font-weight: bold; /* Always bold to avoid shifting on hover */
}

.selected {
  background: rgba(0,100,0,0.2);
  font-weight: bold;
  line-height: 23px;
  cursor: default;
}

.selected:hover {
  background: rgba(0,100,0,0.3);
}

.bulkResultRow {
  line-height: 23px; /* TODO: not this */
}

.overlayButton {
  padding: 10px;
  border-radius: 3px;
}

.overlayButton:focus {
  border-color:var(--theme-focus-color);
}

#helpBtn {
  opacity: 0.8;
  cursor: pointer;
}

#helpBtn:hover {
  opacity: 1;
}

.noSearchRow {
  text-align: center;
}

/* Purge overlay */
#purgeContainer {
  & h1, h2 {
    text-align: center;
  }

  & hr {
    width: 60%;
    min-width: 600px;
    min-width: calc(min(90%, 600px));
    margin-top: 15px;
  }

  & .buttonContainer {
    text-align: center;
    width: auto;
  }

  & #purgeResolutionContainer {
    text-align: center;
    width: 60%;
    margin: auto;
    margin-bottom: 20px;
  }

  & #purgeResolutionDescription {
    size: 10pt;
  }
}

#helpOverlayHolder {
  margin: auto;
  text-align: center;

  & .justify {
    text-align: justify;
  }
  
  & .expandableHeader {
    cursor: pointer;
    margin-top: 10px;
    display: inline-block;
  }

  & .okButton {
    padding: 10px 30px 10px 30px;
    border: 1px solid var(--theme-border);
    border-radius: 5px;
  }

  & .helpSubsection {
    text-align: center;
  }

  & code.topAligned {
    vertical-align: top;
  }
}

#helpMain, #helpDisclaimer, #timeInputMethods {
  max-width: 600px;
  margin: auto;
}

.helpTable {
  display: table;
  border-collapse: collapse;
  white-space: normal;
  margin-top: 10px;

  & th, td {
    border: 2px solid var(--theme-border);
    padding: 3px 5px 3px 5px;
  }

  & th {
    background-color: var(--success-background-subtle);
  }

  & .tableReference {
    text-decoration: none;
  }
}

.wideHelpTableHolder {
  overflow-x: auto;
  margin: auto;
}

.wideHelpTable {
  min-width: 600px;
  max-width: 1200px;
}

.helpTableHolder {
  & td {
    text-align: left;
  }

  & .noteRow {
    border: none;
    padding: 2px 0 2px 0;
    font-style: italic;
    font-size: smaller;
  }

  & .helpTableDescription {
    font-size: smaller;
  }

  & .helpTableSmaller {
    font-size: smaller;
  }
}

#timeInputMethods {
  & ul {
    list-style-position: inside;
    text-align: left;
    text-indent: -20px;
    margin-left: 20px;

    & li {
      margin-bottom: 3px;
    }

    & .syntaxDescription {
      font-size: smaller;
    }
  }

  & ul.codeStart {
    text-indent: -22px; /* Accounts for 2px <code> padding */
  }

  & code {
    background-color: var(--code-background);
    padding: 0 2px 0 2px;
    border-radius: 2px;
    margin: 2px 2px 0 2px;
  }
}

.confirmDelete:hover {
  background-color: var(--overlay-red-hover);
}

.purgedIcon {
  padding-left: 2px;
  vertical-align: text-top;
}

.bulkActionEpisodeColumn {
  max-width: 400px
}

#updateBar {
  top: 0;
  left: 0;
  width: auto;
  padding-bottom: 10px;
  text-align: center;
  line-height: 30px;
  overflow: auto;
  background-color: var(--update-bar-background);

  & * {
    vertical-align: middle;
  }

  & select, .button {
    background-color: var(--update-bar-input-background);
  }

  & select:hover, .button:hover {
    background-color: var(--update-bar-input-background-hover);
  }

  & #updateString {
    margin-right: 20px;
  }

  & #updateRemindLabel {
    margin-left: 30px;
  }
}

.filterActive {
  background-color: rgba(0, 140, 0, 0.5);
  border-radius: 5px;
}

.filteredGroupIndicator {
  opacity: 0.7;
  margin-right: 5px;
  vertical-align: text-top;
}

.filterMultiInput {
  float: right;
}

/* TODO: Not this. Need better separation from settings dialog/a shared base class */
.filterSelect, .filterNumberInput {
  float: unset !important;
}

.sectionOptionsOverlayContainer {
  max-width: 600px;
  margin: auto;
  text-align: center;
  background: var(--overlay-modal-background);
  padding: 20px;
}

.sectionOptionsOverlayBtn {
  width: 60%;
  min-width: 200px;
  size: larger;
  clear: both;
  text-align: center;
  padding-top: 10px;
  padding-bottom: 10px;
}

.sectionOptionsOverlayBtn:hover {
  background: var(--section-options-input-hover);
}

.inlineLoadingIcon {
  margin-right: 10px;
  vertical-align: bottom;
}

#chapterZone select {
  max-width: 250px; /** Don't get too crazy with extremely long episode/chapter titles */
}

#toastContainer {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 4; /* Show over nav/overlay */
}


.toast {
  clear: both;
  padding: 15px;
  margin-bottom: 10px;
  max-width: 300px;
  border-radius: 3px;
  opacity: 0;
  font-size: smaller;

  & h4 {
    padding: 0;
    margin: 0;
  }
}

.toast.warnToast {
  background-color: var(--warn-background);
  border: 1px solid var(--warn-border);

  & hr {
    border-color: var(--warn-border);
  }
}

.toast.errorToast {
  background-color: var(--error-background);
  border: 1px solid var(--error-border);

  & hr {
    border-color: var(--error-border);
  }
}

.toast.infoToast {
  background-color: var(--info-background);
  border: 1px solid var(--info-border);

  & hr {
    border-color: var(--info-border);
  }
}

.toast.successToast {
  background-color: var(--success-background);
  border: 1px solid var(--success-border);

  & hr {
    border-color: var(--success-border);
  }
}

/* Icons */
.themeIconStandard {
  color: var(--theme-primary);
}

.themeIconGreen {
  color: var(--theme-green);
}

.themeIconRed {
  color: var(--theme-red);
  fill: var(--theme-red);
}

.themeIconOrange {
  color: var(--theme-orange);
}

.smallScreenMarkerCount {
  border-left: 1px solid var(--theme-border);
  padding-left: 3px;
}

.inlineFlex {
  display: inline-flex;
}

.inlineFlex>label {
  margin-right: 5px;
}

.episodeDisplayText {
  margin-left: 15px;
  flex: 0 0 fit-content; /* Always keep it on one line */
  text-align: right;
}

.episodeDisplayHolder {
  vertical-align: middle;
}

@media (min-width: 767px) { /* Probably not a phone */
  #topRightControls {
    right: 30px;
  }

  #mobileKeyboard {
    display: none;
  }

  /* Includes percentage with extended stats, so takes up more space than the mobile display */
  .showResult:not(.selected)>.showResultEpisodes,
  .showResult:not(.selected)>.showResultSeasons {
    flex: 0 1 25%;
  }

  .episodeName {
    flex: 1 1 fit-content;
  }

  .purgedIcon {
    height: 16px;
  }

  .mobileBreak {
    display: none;
  }
}

@media all and (max-width: 767px) { /* Probably a phone */
  /* width*/
  ::-webkit-scrollbar {
    width: 3px;
    height: 3px;
  }

  /* The help button runs into the same issues as the theme toggle.
  * We don't want to hide it though, so just adjust its right margin to give it more room. */
  #topRightControls {
    right: 10px;
  }

  .buttonIconAndText.shrinkable .buttonText {
    display: none;
  }

  .dynamicText {
    font-size: smaller;
  }

  .seasonResult.dynamicText {
    padding: 6px 10px 6px 20px;
  }

  .topLevelResult.dynamicText {
    padding: 6px 10px 6px 10px;
  }

  .markerInfoIcon {
    vertical-align: middle;
  }

  .showResult:not(.selected)>.showResultEpisodes,
  .showResult:not(.selected)>.showResultSeasons {
    flex: 0 1 calc(max(15%, 95px));
  }

  .purgedIcon {
    height: 14px;
  }

  .mobileBreak {
    display: block;
  }
}
