@use '../../_global/styles/mixins' as *;
@use '../../_global/styles/vars' as *;

.mwf-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  width: 100%;
  > * {
    flex-basis: 100%;
    &.width--s {
      flex-basis: calc(20% - 16px);
    }
    &.width--m {
      flex-basis: calc(50% - 10px);
    }
    &.width--l {
      flex-basis: calc(80% - 4px);
    }
    @media (max-width: 767px) {
      flex-basis: 100% !important;
    }
  }
}

.mwf-textinput,
.mwf-select,
.mwf-checkboxgroup,
.mwf-radiogroup,
.mwf-textarea,
.mwf-file {
  display: flex;
  flex-direction: column;

  &.has-error {
    input, select, textarea {
      box-shadow: 0 0 0 2px red, 0 0 8px 2px red;
    }
  }

  p,
  .mwf-file__label {
    margin: 0;
  }

  .mwf-checkboxgroup__options,
  .mwf-radioroup__options {
    order: 1;
  }

  input,
  select,
  textarea {
    order: 2;
  }

  .mwf-textinput__hint,
  .mwf-select__hint,
  .mwf-checkbox__hint,
  .mwf-radio__hint,
  .mwf-textarea__hint,
  .mwf-file__hint {
    order: 3;
    text-align: end;
    font-size: 16px;
    font-weight: 600;
  }

  .mwf-textinput__error,
  .mwf-select__error,
  .mwf-checkboxgroup__error,
  .mwf-radiogroup__error,
  .mwf-textarea__error {
    order: 4;
  }
}

.mwf-checkboxgroup .mwf-checkboxgroup__options,
.mwf-radiogroup .mwf-radiogroup__options {
  padding: 0 15px;
}

.mwf-checkboxgroup,
.mwf-radiogroup {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  &.horizontal {
    .mwf-checkboxgroup__options,
    .mwf-radiogroup__options {
      display: flex;
      .mwf-checkbox,
      .mwf-radio {
        margin-right: 30px;
      }
    }
  }
  legend {
    font-size: var(--font-size-small);
    margin-bottom: 5px;
  }
}

.mwf-checkbox,
.mwf-radio {
  input {
    margin-top: 2px !important;
    margin-right: -30px !important;
  }
  label {
    margin-left: 35px;
  }
}

.mwf-textinput__label {
  //display: flex;
}

.mwf-file {
  .mwf-file__legend {
    order: 1;
  }

  .mwf-file__uploaded {
    order: 3;
    .mwf-file__ul {
      padding: 10px 0 0 0;
      margin: 0;
      .mwf-upload-row {
        @media (min-width: 768px) {
          display: flex;
          justify-content: space-between;
          align-items: center;
        }
      }
      .mwf-upload-fileinfo {
        display: flex;
        align-items: center;
        .mwf-upload-preview {
          height: 50px;
          width: 50px;
          background-size: cover;
          margin-right: 10px;
        }
        .mwf-upload-metadata {

        }
      }
      ul {
        padding: 0;
        list-style: none;
        font-size: 12px;
      }
    }
    .mwf-upload-actions, .mwf-file__uploaded-actions {
      padding: 0;
      button {
        margin-left: 10px;
        padding: 10px 24px;
        background-color: var(--color-button-primary-background);
        color: var(--color-button-primary-text);
        border-radius: var(--border-radius-md);
        border: none;
        line-height: 1;
        text-decoration: none;
        font-family: 'Korb', sans-serif;
        cursor: pointer;
        font-weight: 400;
        transition: 0.2s ease;
        @include focus-visible;
      }
    }
  }

  .mwf-file__dropzone {
    order: 2;
    background-color: var(--color-background);
    border: 2px dashed #ccc;
    display: block;
    text-align: center;
    label {
      color: var(--color-text);
      font-size: 110%;
      font-weight: 200;
      line-height: 1.5em;
      padding: 2em .5em 5em .5em;
      font-family: 'Korb', sans-serif;
      position: relative;
      display: block;
      &:after {
        position: absolute;
        left: 50%;
        bottom: 1em;
        transform: translate(-50%, 0);
        content: "Datei auswählen";
        background-color: var(--color-button-primary-background);
        color: var(--color-button-primary-text);
        border-radius: var(--border-radius-md);
        box-shadow: 0 0 0 2px var(--color-button-primary-background);
        cursor: pointer;
        display: inline-flex;
        font-family: 'Korb', sans-serif;
        font-size: var(--font-size-copy);
        font-weight: 400;
        line-height: 1;
        padding: 10px 24px;
        white-space: nowrap;
      }
      input {
        opacity: 0;
        cursor: pointer;
        font-size: 20px;
        margin: 0;
        padding: 0;
        position: absolute;
        left: 50%;
        top: 0;
        transform: translate(-50%, 0);
      }
    }
  }
}

.mwf-form__actions {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--color-surface-inset);
  margin-bottom: 20px;
}

ul.mwf-summary__list {
  list-style: none;
  padding: 0;
  font-size: var(--font-size-small);

  li.mwf-summary__item {
    display: flex;
    padding: 15px;
    border-top: 1px solid var(--color-surface-inset, #ccd7e6);
    border-bottom: 1px solid var(--color-surface-inset, #ccd7e6);

    &:nth-child(even) {
      background-color: var(--swatches-primary-100);
    }

    span.mwf-summary-item__label {
      flex: 0.4;
    }

    span.mwf-summary-item__value {
      flex: 0.6;
    }
  }
}

.mwf-form {
  .row.requireText {
    margin-left: 0;
  }
}

#ui-datepicker-div {
  background-color: var(--swatches-neutrals-white);
  border: var(--text-accent-default) 1px solid;

  .ui-datepicker-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .ui-datepicker-prev, .ui-datepicker-next {
    padding: 0 10px;
    cursor: pointer;
  }

  .ui-datepicker-title {
    width: 100%;
    display: flex;
  }
}
