.help-block {
  color: $text-muted;
}

.content-placeholder {
  padding-left: 2px;
  padding-right: 2px;
  background: $gray-lighter;
  border: 0;
  border-radius: $border-radius-base;
  margin-bottom: 4px;
  margin-right: 6px;
}

td > .form-group {
  margin-bottom: 0;
}

td > .errorlist {
  color: #a94442;
  list-style-type: none;
  padding: 0;
  margin: 0;
}

td > .form-group > .checkbox {
  margin-top: 0;
  margin-bottom: 0;
}

.static-form-row {
  padding-top: 7px;
}
.static-form-row-with-btn {
  padding-top: 3px;
}

.form-inline .form-control {
  max-width: 100%;
}

.has-success .form-control {
  border-color: #cccccc;
}

.panel-body div.alert:last-child {
  margin-bottom: 0;
}

.form-group.disabled {
  opacity: 0.5;
}

.form-horizontal [data-formset] .form-group {
  width: 100%;
}

[data-formset] .form-group:not([data-formset-form-deleted]):last-of-type [data-formset-move-down-button],
[data-formset] .form-group:not([data-formset-form-deleted]):first-of-type [data-formset-move-up-button] {
  cursor: not-allowed;
  pointer-events: none; // Future-proof disabling of clicks
  @include opacity(.65);
  @include box-shadow(none);
}

div[data-formset-body], div[data-formset-form], div[data-nested-formset-form], div[data-nested-formset-body], details[data-formset-form] {
  width: 100%;
}

.form-plugins .panel-title {
  line-height: 34px;
}

.restriction-formset .variations label {
  margin: 0;
}

.formset-row {
  margin-bottom: 10px;
}

.submit-group {
  margin: 15px 0 0 0 !important;
  padding: 15px;
  background: #eeeeee;
  text-align: right;
  .btn-save {
    // btn-lg
    @include button-size($padding-large-vertical, $padding-large-horizontal, $font-size-large, $line-height-large, $btn-border-radius-large);
  }
  .btn-cancel, .btn-alternative {
    float: left !important;
    // btn-lg
    @include button-size($padding-large-vertical, $padding-large-horizontal, $font-size-large, $line-height-large, $btn-border-radius-large);
  }
}

.panel .form-group:last-child {
  margin-bottom: 0;
}

.tabbed-form > .tab-pane {
  padding: 10px;

  & > h4 {
    // like bs3 legend
    display: block;
    width: 100%;
    padding: 0;
    margin-bottom: $line-height-computed;
    font-size: ($font-size-base * 1.5);
    line-height: inherit;
    color: $legend-color;
    border: 0;
    border-bottom: 1px solid $legend-border-color;
  }
}

.nav-tabs {
  border-bottom: 0px solid #ddd;
}

.tab-content {
    border: 1px solid #ddd;
    border-radius: 0px 5px 5px 5px;
    padding: 5px 5px 0px 5px;
}

.mail-preview-group {
  margin-bottom: -15px;
}

.variation-matrix {
  td .form-group, .checkbox {
    margin: 0;
  }
}

.table-quotas td ul {
  list-style: none;
  margin-left: 0;
  padding-left: 0;
  margin-bottom: 0;
}

.question-option-row {
  padding: 5px 0;
}

.i18n-form-group .i18n-field-markdown-note {
  border: 1px solid $input-border;
  color: $text-muted;
  font-size: 0.8em;
  padding: 0.2em;
  &::before {
    display: inline-block;
    height: 0.6em;
    width: 1.5em;
    position: relative;
    top: 0.1em;
    left: 0.1em;
    opacity: 50%;
    margin-right: 0.5em;
    content: url(static('pretixcontrol/img/icons/markdown-mark-solid.svg'));
  }
}

.i18n-form-group input,
.i18n-form-group textarea,
.i18n-form-group .i18n-field-markdown-note {
  @include border-top-radius(0px);
  @include border-bottom-radius(0px);
  border-top-width: 0;

  &:first-child {
    @include border-top-radius($input-border-radius);
    border-top-width: 1px;
  }
  &:last-child {
    @include border-bottom-radius($input-border-radius);
  }
}

@media (min-width: $screen-sm-min) {
  .variation-matrix > tbody > tr > td {
    line-height: 34px;

    input[type=checkbox] {
      margin-top: 10px;
    }
  }
}
.ticketoutput-panel .panel-title {
  line-height: 30px;
}

div.mail-preview {
  border: 1px solid #ccc;
  border-top-width: 1px;
  border-radius: 3px;

  .placeholder {
    background: transparentize($brand-warning, 0.6);
  }
}

.mail-preview-group div[lang] {
  @include border-top-radius(0px);
  @include border-bottom-radius(0px);
  border-top-width: 0;
  margin-bottom: 0;
  padding-right: 15px;
  padding-bottom: 8px;

  &:first-child {
    @include border-top-radius($input-border-radius);
    border-top-width: 1px;
  }
  &:last-child {
    @include border-bottom-radius($input-border-radius);
    margin-bottom: 20px;
  }
  h2, h3 {
    margin-bottom: 20px;
    margin-top: 10px;
  }
  p {
    margin: 0 0 10px;

    /* These are technically the same, but use both */
    overflow-wrap: break-word;
    word-wrap: break-word;

    -ms-word-break: break-all;
    /* This is the dangerous one in WebKit, as it breaks things wherever */
    word-break: break-all;
    /* Instead use this non-standard one: */
    word-break: break-word;

    /* Adds a hyphen where the word breaks, if supported (No Blink) */
    -ms-hyphens: auto;
    -moz-hyphens: auto;
    -webkit-hyphens: auto;
    hyphens: auto;
  }
  p:last-child {
    margin-bottom: 0;
  }
  /* Reset styling from bootstrap that we don't actually have in emails */
  pre {
    background: none;
    border: none;
    padding: 0;
  }
}

.search-line {
  width: 100%;
  margin-bottom: 20px;

  .input-group-btn {
    width: 1% !important;
  }
}
.input-group-smaller-height {
  .form-control {
    height: 32px;
  }
  .btn {
    padding-top: 5px;
    padding-bottom: 5px;
  }
}
.input-group-btn .btn {
  padding-bottom: 8px;
}
.reldatetime {
  input[type=text], select {
    display: inline-block;
    max-width: 200px;
  }
  input[type=number] {
    display: inline-block;
    width: 80px;
  }
}
input[type=number].short {
  width: 80px !important;
}

.geodata-autoupdate {
  display: block;
}
.geodata-autoupdate .btn-link {
  padding: 0;
}
.geodata-autoupdate [data-notification] {
  display: none;
}
[data-notify=error] [data-notification=error],
[data-notify=loading] [data-notification=loading],
[data-notify=updated] [data-notification=updated],
[data-notify=confirm] [data-notification=confirm] {
  display: block;
}

.geodata-group {
  .form-group {
    margin: 0 0 10px 0;
  }
  .attrib {
    padding: 0;
    margin: 0;
    font-size: $font-size-small;
    a {
      color: $text-muted;
    }
  }
  .leaflet-container {
    height: 200px;
    margin: 0;
  }
  /* fix leaflet overlay datetime-picker, see https://github.com/pretix/pretix/issues/2480 */
  .leaflet-top,
  .leaflet-bottom {
    z-index: 900;
  }
}
.metadata-group {
  .form-group {
    margin: 0 0 10px 0;
  }
  .row label {
    padding-top: 7px;
  }
}
.inline-multiple-choice {
  .checkbox {
    display: inline-block;
    margin-top: 0;
    margin-right: 10px;
  }
}
.splitdatetimerow {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;

  .help-block {
    width: 100%;
  }
}
.splitdatetimepart {
  width: 50%;
  display: inline-block;

  &.datepickerfield {
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
  }
  &.timepickerfield {
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
    border-left: 0;
  }
}

.photo-initial {
  margin-bottom: 5px;
}
.photo-preview {
  max-width: 550px;
  width: 100%;
  height: auto;
  margin-top: 10px;

  img {
    display: block;
    max-width: 100%;
  }
}

.propagated-settings-box.locked {
  .propagated-settings-form {
    opacity: 0.7;
    pointer-events: none;
  }
  .panel-body.help-text {
    border-bottom: 1px solid $panel-default-heading-bg;
  }
}
.propagated-settings-box.unlocked {
  border: 0;
  transition: border-width 0.5s linear;
  .panel-heading, .panel-body.help-text {
    height: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    transition: height 0.5s linear, padding 0.5s linear, border-width 0.5s linear;
  }
  .panel-body {
    padding: 0;
    transition: padding 0.5s linear;
  }
}
@media (max-width: $screen-sm-max) {
  .propagated-settings-box {
    min-height: 250px;
  }
}

label.label-empty {
  pointer-events: none;
}
label.no-bold {
  font-weight: normal;
}
label .optional {
  color: $text-muted;
  font-weight: normal;
}
@media (max-width: $screen-sm-max) {
  .form-horizontal .control-label {
    text-align: left;
  }
}
.select2-hidden-accessible {
    top: 50px;
}
.select2-selection__placeholder {
  font-style: italic;
}
.large-select2-field-container .select2-container--bootstrap .select2-selection--multiple {
  height: 150px;
  overflow-y: auto;
}
div.scrolling-multiple-choice, div.scrolling-choice {
  height: 150px;
  border: 1px solid $input-border;
  border-radius: $input-border-radius;
  padding: 5px 15px;
  overflow-y: scroll;

  .radio:first-of-type, .checkbox:first-of-type {
    margin-top: 0;
  }
  &.scrolling-multiple-choice-large {
    height: 350px;
  }
  div.choice-options-menu {
    display: flex;
    flex-direction: row;
    align-items: center;
    font-size: 12px;
    border-bottom: 1px solid $input-border;
    margin: 0 -15px;
    padding: 0 15px 5px;
    span {
      display: block;
    }
    .checkbox {
      padding-top: 3px;
    }
    .form-control {
      flex: auto 1 1;
      width: auto;
      margin: 0 10px 0 10px;
      font-size: 12px;
      height: auto;
      padding: 2px 6px;
    }
    .form-control:first-child {
      margin: 0;
    }
  }
}
table td > .checkbox {
  margin: 0;
  position: static;
}
table td > .checkbox input[type="checkbox"] {
  margin: 0;
  position: static;
}
.panel-title .radio {
  margin-left: 20px;
}

.form-quicksetup-total-capacity {
  height: 34px;
  strong {
    line-height: 34px;
  }
}
.form-horizontal [data-formset] .form-quicksetup-total-capacity .form-group {
  margin: 0;
  width: auto;
}
.form-quicksetup-total-capacity .form-control {
  width: 100px;
  display: inline;
}
.form-horizontal .rrule-form .form-group {
  margin: 0;
  width: auto;
}
.rrule-form {
  .form-control {
    display: inline;
  }
  input[type=number] {
    width: 100px;
  }
  .repeat-yearly, .repeat-monthly, .repeat-weekly {
    line-height: 35px;
    padding: 0 0 15px 0;
    margin: 10px 0;
    border-top: 1px solid $panel-default-border;
    border-bottom: 1px solid $panel-default-border;

    input[type="radio"], input[type="checkbox"] {
      top: 2px;
    }
  }
  .repeat-weekly > div.form-group {
    display: block;
    line-height: 1;
    padding-top: 5px;

    & > div {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      align-content: space-between;
      div.checkbox {
        flex-grow: 1;
      }
    }
  }
  .repeat-until {
    line-height: 40px;
  }
}
#time-formset {
  input {
    display: block;
    width: 100%;
  }
  .form-group {
    margin: 0;
  }
  .row {
    margin-bottom: 15px;
  }
}
.ticketoutput-panel .panel-heading {
  .checkbox {
    padding: 0;
    display: inline-block;
    input[type=checkbox] {
      margin-top: 0;
      margin-right: 5px;
      margin-left: 0px;
      position: relative;
      top: 1px;
    }
  }
}
.form-horizontal .big-radio {
  border: 1px solid #ccc;
  border-bottom: 0;
  padding: 0;
  label {
    padding: 15px 15px 15px 30px;
  }

  .help-block {
    margin-bottom: 0;
  }
  &:first-child {
    border-top-left-radius: $border-radius-base;
    border-top-right-radius: $border-radius-base;
  }
  &:last-child {
    border-bottom-left-radius: $border-radius-base;
    border-bottom-right-radius: $border-radius-base;
    border-bottom: 1px solid #ccc;
  }
}
.accordion-radio {
  display: block;
  margin: 0;
}
.panel-default>.accordion-radio>.panel-heading {
  color: #333;
  background-color: #f5f5f5;
  padding: 12px 15px;

  input[type=checkbox] {
    margin-top: 0;
    margin-right: 5px;
    position: relative;
    top: 2px;
  }
}
.maildesignpreview {
  label {
    display: block;
  }
  img {
    display: block;
    width: 90%;
    margin: 10px auto;
    height: auto;
    box-shadow: 0 1px 3px 0 #aaa;
  }
}

.form-order-change, .form-refund-choose {
  .row {
    padding: 5px 0;
  }
}
.form-refund-choose {
  .payment-details {
    max-width: 200px;
  }
  .refund-amount {
    width: 250px;
    input.form-control {
      width: 100px;
    }
  }
}

@media(max-width: $screen-xs-max) {
  .nameparts-form-group {
    display: block;
    input:not(:first-child), select:not(:first-child) {
      border-top-right-radius: 0;
      border-top-left-radius: 0;
    }
    input:not(:last-child), select:not(:last-child) {
      border-bottom-right-radius: 0;
      border-bottom-left-radius: 0;
    }
  }
}
@media(min-width: $screen-sm-min) {
  .nameparts-form-group {
    display: flex;
    flex-direction: row;
    input, select {
      min-width: 5em;
      flex-basis: 0;
      flex-grow: 1;
    }
    input:not(:first-child), select:not(:first-child) {
      border-bottom-left-radius: 0;
      border-top-left-radius: 0;
    }
    input:not(:last-child), select:not(:last-child) {
      border-bottom-right-radius: 0;
      border-top-right-radius: 0;
    }
    [data-size="1"] {
      flex-grow: 1;
      flex-shrink: 4;
    }
    [data-size="2"] {
      flex-grow: 2;
      flex-shrink: 3;
    }
    [data-size="3"] {
      flex-grow: 3;
      flex-shrink: 2;
    }
    [data-size="4"] {
      flex-grow: 4;
      flex-shrink: 1;
    }
  }
}

.help-inline {
  color: lighten($text-color, 25%); // lighten the text some for contrast
}

.panel .filter-form {
  .form-group {
    margin-bottom: 10px;
  }

  label.control-label {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .one-line-checkboxes {
    div.checkbox {
      display: inline-block;
      margin-right: 10px;
      margin-top: 0;
    }
  }
}

#rules-editor {
  .checkin-rule {
    border: 1px solid lighten(#000, 80%);
    border-left: 4px solid lighten(#000, 80%);
    border-radius: $border-radius-base;
    padding: 10px 15px 10px 15px;
    margin: 5px 0;
    position: relative;
    &:hover {
      border-color: $brand-primary;
      border-left-color: $brand-primary;
    }
  }

  .checkin-rule-and {
    &:hover {
      border-color: $brand-danger;
      border-left-color: $brand-danger;
    }
  }
  .checkin-rule-or {
    &:hover {
      border-color: $brand-success;
      border-left-color: $brand-success;
    }
  }
}

.checkin-rules-visualization {
  svg {
    width: 100%;
    height: auto;
    .node {
      stroke: $gray-light;
      stroke-width: 2px;
      fill: #fff;
      &:hover {
        stroke: $brand-primary;
      }
    }
    .node-false {
      stroke: $brand-danger;
    }
    .node-true {
      stroke: $brand-success;
    }
    .edge {
      stroke: $gray-light;
      stroke-width: 2px;
      fill: none;
    }
    .check {
      fill: $brand-success;
    }
    .error {
      fill: $brand-danger;
    }
    .text {
      font-size: 12px;
      width: 100%;
      height: 100%;
      overflow-y: auto;
      cursor: default;
      text-align: center;
    }
  }

  position: relative;
  .tools {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
  }
  &:hover .tools {
    opacity: 1;
  }

  &.maximized {
    background: white;
    position: fixed;
    top: 51px;
    left: 0;
    width: 100vw;
    max-height: none;
    height: 100vh;
    height: calc(100vh - 51px);
    z-index: 90000;

    svg {
      height: 100%
    }
  }
}

.tax-rules-formset {
  margin-left: -15px;
  margin-right: -15px;
}
.tax-rule-line {
  padding-top: 5px;
  margin: 0;
  & > div {
    padding-top: 5px;
    padding-bottom: 5px;
  }
}
.tax-rule-lines .tax-rule-line {
  border-bottom: 1px solid $input-border;
  padding-bottom: 5px;
}

.batch-select-label {
  display: block;
  width: 100%;
  height: 1.5em;
  cursor: pointer;
  margin: 0;
}

.dropdown-menu > li > button.btn {
  display: block;
  padding: 3px 20px;
  clear: both;
  font-weight: 400;
  line-height: $line-height-base;
  color: $dropdown-link-color;
  white-space: nowrap;
  background: inherit;
  border: 0;
  width: 100%;
  text-align: left;

  &:hover, &:focus {
    color: $dropdown-link-hover-color;
    text-decoration: none;
    background-color: $dropdown-link-hover-bg;
  }
}

.bulk-edit-field-group {
  .field-toggle {
    font-weight: normal;
    display: inline-block;
    background: $gray-lighter;
    padding: 2px 8px 4px;
    border-top-left-radius: $border-radius-base;
    border-top-right-radius: $border-radius-base;
    margin-bottom: 0;
    input {
      position: relative;
      top: 2px;
    }
  }
  .field-content {
    border: 2px solid $gray-lighter;
    padding: 15px;
    opacity: 0.5;
    .datepickerfield::placeholder, .timepickerfield::placeholder {
      opacity: 0;
    }
    &.enabled {
      opacity: 1;
      .datepickerfield::placeholder, .timepickerfield::placeholder {
        opacity: 1;
      }
    }
  }
}

@media (min-width: $screen-md-min) {
  .table-responsive-small-only {
    overflow-x: visible;
  }
}
.pos-relative {
  position: relative;
}

#subevent-bulk-create-form {
  fieldset {
    margin-bottom: 40px;
  }
}
.subevent-itemvar-group {
  label.control-label {
    padding-top: 0;
  }
  label:not(.control-label) {
    font-weight: normal;
  }
}

details {
  summary .chevron::before {
    content: $fa-var-caret-right;
  }
  &[open] .chevron::before {
    content: $fa-var-caret-down;
  }
}

#item_variations {
  summary small {
    display: inline-block;
    margin-left: 2.1em;
  }
  .variation-icon-hidden {
    opacity: 0;
    pointer-events: none;
  }
  .variation-disabled {
    text-decoration: line-through;
  }
}

.select2-container [aria-multiselectable] .select2-results__option > span > strike:first-child::before,
.select2-container [aria-multiselectable] .select2-results__option > span > span:first-child::before {
  content: "";
  font-family: FontAwesome;
  display: inline-block;
  padding-right: 5px;
  width: 1.28571em;
  text-align: center;
}
.select2-container [aria-multiselectable] .select2-results__option[aria-selected=true] > span > strike:first-child::before,
.select2-container [aria-multiselectable] .select2-results__option[aria-selected=true] > span > span:first-child::before {
  content: ""
}

.form-alternatives {
  div .control-label {
    text-align: left;
  }
}
.condition-or {
  .sepText {
    width: 75px;
    background: #FFFFFF;
    margin: -15px 0 0 -38px;
    padding: 5px 0;
    position: absolute;
    top: 50%;
    text-align: center;
  }

  .hr {
    width:2px;
    height:64px;
    background-color: #DDDDDD;
    position:inherit;
    top:12px;
    left:50%;
    z-index:10;
  }
}

@media (max-width: $screen-sm-max) {
  .condition-or {
    .hr {
      width: 100%;
      height: 2px;
      left: 0px;
      top: 4px;
      margin: 15px 0 15px 0;
    }

    .sepText {
      left: 50%;
    }
  }
}
