@import "bootstrap/bootstrap";

@import "../fonts/icons/css/animation.css";
@import "../fonts/icons/css/mlinvoice-embedded.css";

@import "variables";

html {
  height: 100%;
  font-size: 0.8rem;
}

body {
  margin: 0;
  height: 100%;
}

content::after {
  content: "";
  clear: both;
  display: table;
}

.navbar {
  background-color: #eef1f8;
}

form {
  margin-bottom: 0px;
  margin-top: 0px;
}

h1 {
  font-size: 1.2rem;
}
h2 {
  font-size: 1.1rem;
}
h3 {
  font-size: 1rem;
}

div.pagewrapper {
  min-height: 100%;
}

div.navi {
  padding: 4px 4px 0px 4px;
  border-bottom: 1px solid #DDDDDD;
}

div.breadcrumbs a {
  font-weight: bold;
  font-size: 1.1rem;
}

span.prev-next {
  margin: 6px 0 6px 16px;
}

div#version {
  float: right;
  margin-top: 4px;
  margin-right: 1rem;
}

div.function_navi {
	clear: both;
  padding: 4px 0px 4px 10px;
}

#admin_form {
  display: flex;
  flex-wrap: wrap;
  box-sizing: border-box;
  .field:not(.hidden) {
    display: flex;
    flex: 1 1 500px;

    .toplabel {
      align-self: flex-start;
    }

    align-items: center;

    margin-right: 20px;
    box-sizing: border-box;

    label {
      flex: 0 0 30%;
      padding-right: 8px;
    }
    .field-contents {
      &:not(.markdown, .check) {
        display: flex;
      }
      &.markdown {
        padding-right: 4px;
      }
      &.image {
        flex: 0 0 100%;
      }
      flex: 0 1 70%;
      .select2-container, .editor-toolbar, .CodeMirror-wrap {
        width: 100%;
      }
      .select2-container {
        margin-top: 2px;
        &.linked {
          width: 60%;
        }
      }
      .short {
        width: 60px;
      }
      .medium, .date {
        width: 150px;
      }
      .long {
        width: 240px;
      }
      textarea.wide {
        height: 100px;
        width: 100%;
      }
      textarea.email_body {
        width: 100%;
      }
      &.attached {
        button {
          margin-left: 6px;
        }
      }
    }
    .select-default-text {
      flex: 0 0 20px;
      align-self: normal;
      margin-left: 2px;
    }
  }
  .sublabel, .clear-row {
    flex: 0 0 100%;
  }
  @media (min-width: $form-split-width) {
    .field:not(.hidden) {
      max-width: min(calc(50% - 20px), 600px);
    }
  }
}

.list_container {
  margin-top: 10px;
  max-width: 1400px;
}
.form .list_container {
  max-width: none;
}
.iform.list_container {
  margin-left: 0;
  margin-right: 0;
}

.login div.message {
  margin: 30px 30px 0 30px;
  padding: 8px;
  display: block;
}

.login-form, .logout-form, .recover-form {
  padding: 30px;
}
.recover-form {
  .message {
    padding: 8px;
    display: block;
  }
  .form-control {
    width: 160px;
  }
}

.alert {
  max-height: 400px;
  overflow: scroll;
}

.profile div.message {
  padding: 8px;
  display: block;
}

span.message {
  margin: 4px;
  padding: 1px;
}

div.form_container {
  clear: both;
  .btn-group {
    margin-bottom: 0.5rem;
  }
}

div.tiny_label {
  width: 40px;
  float: left;
  margin-bottom: 8px;
  clear: left;
}

div.small_label {
  width: 100px;
  float: left;
  margin-bottom: 8px;
  clear: left;
}

div.medium_label {
  width: 160px;
  float: left;
  margin-bottom: 8px;
  clear: left;
  padding-top: 2px;
  &.attached {
    clear: none;
  }
}

div.unlimited_label {
  margin-bottom: 8px;
  clear: left;
  font-size: 1.1rem;
}

div.field {
  margin-bottom: 8px;
}

div.static-field {
  margin-bottom: 8px;
  padding-top: 2px;
}

div.report {
  margin: 10px;
}

div.report td, div.report th {
  padding-right: 10px;
}

table {
  border-style: none;
  border-width: 0px;
  padding: 0px;
  border-spacing: 0;
}
table.list {
  clear: both;
  border: 1px solid #cccccc;
}

table.iform {
  margin: 0px;
  padding: 0px;

  td {
    min-height: 1.8rem;
  }
}

table.iform_popup {
  border: 0;
  margin: 0px;
  padding: 0px;
}

tr.summary td {
  font-weight: bold;
  background-color: transparent;
}

th {
  text-align: left;
}

td {
  font-weight: normal;
  padding: 2px;
}

td.button {
  vertical-align: top;
}

td.field {
  padding-right: 16px;
}

td.error {
  font-weight: bold;
  background-color: #8d5153;
}
.sublabel {
  padding: 2px 2px 2px 2px;
  clear: both;
  margin-bottom: 8px;
}
td.reportsublabel {
  font-weight: bold;
  padding: 2px 2px 2px 2px;
  clear: both;
  margin-top: 10px;
}
.iform, .iform-popup, #custom-prices, .multi-edit-form, .setup-form {
  .date, .date_label {
    width: 90px;
  }
  .tiny, .tiny_label {
    width: 40px;
  }
  .xshort, .xshort_label {
    width: 55px;
  }
  .mediumshort, .mediumshort_label {
    width: 80px;
  }
  .medium, .medium_label {
    width: 180px;
  }
  .long, .long_label {
    width: 240px;
  }
  .currency, .currency_label {
    width: 80px;
    padding-right: 8px;
    text-align: right;
  }
  .count, .count_label {
    width: 60px;
    padding-right: 4px;
    text-align: right;
  }
  .measurement, .measurement_label {
    width: 60px;
    padding-right: 4px;
    text-align: right;
  }
  .cb-select-row {
    width: 15px;
    padding: 0;
  }
  .summary-heading {
    text-align: right;
  }
}

.iform, .iform-popup {
  @media only screen and (max-width: $iform-collapse-max-width) {
    & {
      width: 100%;
    }

    tr:first-child {
      td:last-child {
        margin-bottom: 1rem;
      }
    }
    tr:not(:first-child) {
      border-top: 1px solid $secondary;
    }
    td.button {
      padding-bottom: 0.4rem;
    }
    tr {
      td.sort-col {
        background: rgba(0, 0, 0, 0);
      }
    }
    td.select-row {
      margin-top: -1.5rem;
    }

    td, th {
      display: block;
      width: 100% !important;
      min-height: 1rem;
    }

    .count, .currency, .summary-heading {
      text-align: lefT;
    }
  }

  &.iform-sort-select {
    @media only screen and (max-width: $iform-collapse-max-width) {
      tbody tr:first-child {
        td:nth-child(-n+2) {
          display: none;
        }
      }
    }
  }
}

.iform {
  td.deleted {
    text-decoration: line-through;
  }
  tr:not:nth-child(odd) {
    background-color: transparent;
  }
  tr.item-row:nth-child(odd):hover {
    background: rgba(0, 0, 0, 0.1);
    cursor: pointer;
  }

  tr.summary {
    &:nth-child(even) td {
      background-color: transparent;
    }
  }
  tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.03);
  }
  tr.item-row:nth-child(even):hover {
    background: rgba(0, 0, 0, 0.1);
  }

  tr:nth-child(even) td.button {
    background: rgba(0, 0, 0, 0);
  }

  tr.summary {
     background: rgba(0, 0, 0, 0);
  }

  td.button {
    vertical-align: middle;
    white-space: nowrap;
  }

  td.sort-col {
    min-width: 1.8rem;
    cursor: grab;
  }

  .sort-handle {
    display: none;
  }
  tr:hover {
    .sort-handle {
      display: initial;
    }
  }

  @media only screen and (min-width: $iform-collapse-min-width) and (max-width: $iform-narrow-width) {
    .xshort, .xshort_label {
      width: 45px;
    }
    .short, .short_label {
      width: 50px;
    }
    .mediumshort, .mediumshort_label {
      width: 70px;
    }
    .medium, .medium_label {
      width: 80px;
    }
    .count, .count_label {
      width: 50px;
    }
    .currency, .currency_label {
      width: 65px;
    }
  }

  @media only screen and (max-width: $iform-collapse-max-width) {
    td, th {
      display: block;
      width: calc(100% - 10rem) !important;
      margin-left: 10rem;

      & > div:not(.hidden) {
        display: inline-block;
      }
    }

    td[data-th]:before {
      float: left;
      margin-left: -10rem;
      content: attr(data-th);
    }

    .sort-col {
      height: 0;
    }
    .sort-handle {
      position: relative;
      left: -10rem;
      top: 2px;
    }
    .label.row-summary {
      display: none;
    }
    .modify-controls {
      margin-bottom: 1rem;
    }
  }

  &.iform-sort-select {
    @media only screen and (max-width: $iform-collapse-max-width) {
      thead th:not(:first-child) {
        display: none;
      }
    }
  }
  &:not(.iform-sort-select) {
    @media only screen and (max-width: $iform-collapse-max-width) {
      thead th {
        display: none;
      }
    }
  }
  tbody tr:first-child, tbody tr:last-child {
    border-bottom: 1px solid $gray-600;
    td {
      padding-bottom: 4px;
      margin-bottom: 4px;
    }
  }
}

.iform-popup {
  td {
    vertical-align: top;
    height: 10rem;
    .field-container {
      min-height: 3rem;
    }
    .modification-indicator {
      text-align: left;
      .modification-text {
        vertical-align: middle;
        color: $white;
        background-color: $success;
        padding: 0.3rem;
      }
      button {
        margin-top: 0.5rem;
      }
    }
  }
  @media only screen and (max-width: $iform-collapse-max-width) {
    td, th {
      display: block;
      width: 100% !important;
      height: initial;
    }
  }

  @media only screen and (min-width: $iform-collapse-min-width) and (max-width: $iform-popup-narrow-width) {
    .xshort, .xshort_label {
      width: 45px;
    }
    .short, .short_label {
      width: 50px;
    }
    .mediumshort, .mediumshort_label {
      width: 70px;
    }
    .medium, .medium_label {
      width: 80px;
    }
    .count, .count_label {
      width: 50px;
    }
    .currency, .currency_label {
      width: 65px;
    }
  }

}

.multi-edit-form {
  .field {
    width: 340px;
    float: left;
  }
  textarea.wide {
    height: 100px;
    width: 260px;
  }
}

td.row_sum {
  border-top: 1px solid gray;
  padding-bottom: 8px;
}

td.total_sum {
  margin-top: 4px;
  font-weight: bold;
}

td a {
  text-decoration: underline;
}

td a.navilink {
  text-decoration: none;
  font-weight: normal;
  width: 100%;
  height: 100%;
  display: block;
}
td a.navilink:hover {
  text-decoration: none;
  width: 100%;
  height: 100%;
  display: block;
}

input {
  padding: 0px 0px 0px 0px;
}

select {
  padding: 0px 0px 0px 0px;
}

select.normal {
  padding: 0px 0px 0px 0px;
}

textarea {
  padding: 0px 0px 0px 0px;
  border: 1px solid #ddd;
}

textarea.email_body {
  height: 200px;
  width: 500px;
  font-family: Monaco, "Lucida Console", "Courier New", Courier, monospace;
}
.field-contents {
  &.date.attached {
    margin-top: 2px;
  }
  .CodeMirror:not(.CodeMirror-fullscreen) {
    min-height: 80px;
    height: 80px;
    box-sizing: content-box;
    .CodeMirror-scroll {
      min-height: 80px;
      height: 80px;
      box-sizing: content-box;
    }
  }
  .CodeMirror:not(.CodeMirror-fullscreen), .editor-toolbar:not(.fullscreen) {
    width: 340px;
    padding-left: 2px;
    padding-right: 2px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
  .editor-toolbar:not(.fullscreen) {
    box-sizing: initial;
    &::before {
      margin-bottom: 2px;
    }
    &::after {
      margin-top: 2px;
    }
  }
  &.xxlarge {
    .CodeMirror:not(.CodeMirror-fullscreen) {
      min-height: 200px;
      height: 200px;
      .CodeMirror-scroll {
        min-height: 200px;
        height: 200px;
      }
    }
  }
}

div.iform {
  padding: 0px 0px 0px 0px;
  margin-top: 8px;
  display: table;
}

div.column_mapping {
  border: 1px solid gray;
  clear: both;
  overflow: auto;
}

div#columns {
  margin-top: 1.5rem;
}

a {
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

a.navilink {
  text-decoration: none;
  font-weight: normal;
}
a.navilink:hover {
  text-decoration: underline;
  font-weight: normal;
}

a.buttonlink {
  font-weight: normal;
  margin-bottom: 2px;
}

a.functionlink {
  cursor: pointer;
  font-weight: bold;
}

img.image {
  border: 1px solid #dddddd;
  max-width: 400px;
  max-height: 250px;
  background-color: white;
}

.new_message {
  margin: 20px;
}

.form_buttons {
  margin-top: 0.5rem;
  img {
    vertical-align: middle;
  }
}

.fg-toolbar {
  padding: 4px;
}

.search_row {
  background: rgba(0, 0, 0, 0.05);
}

.field_sep {
	float: left;
	clear: both;
	height: 6px;
}

.pac-container {
	font-size: 120%;
	min-width: 250px;
}

#column_table {
  tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
  }

  tr:nth-child(odd) {
    background: rgba(0, 0, 0, 0.0);
    cursor: pointer;
  }
}

.select-default-text {
  vertical-align: top;
  width: 20px;
}

.select-description {
  padding-left: 1.5rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.bigdrop {
  max-width: 40rem;

  @media only screen and (max-width: 1160px) {
    max-width: 20rem;
  }
}

.hidden {
  display: none;
}

#cover-letter-form {
  margin: 16px;
  border: 1px solid #dddddd;
}

#cover-letter-form-inner {
  padding: 16px;
}

.attachments-dropdown-menu {
  min-width: 40rem;
  padding: 0.5rem;
}

#attachments-form {
  margin-top: 8px;
  margin-bottom: 8px;
  border: 1px solid gray;
  clear: both;
}

#attachments-form-inner {
  padding: 8px;
}

.attachment-list {
  border: 1px solid #dddddd;
  padding: 8px;
  margin: 8px 0 16px 0;
  overflow-x: hidden;
  overflow-y: scroll;
  max-height: 200px;
}

.attachments {
  border: 1px solid #dddddd;
  padding: 8px;
  overflow-x: hidden;
  overflow-y: scroll;
  max-height: 200px;
}

.attachment {
  clear: both;
}

.attachment-new {
  margin-top: 8px;
  height: 24px;
  div {
    float: left;
    margin-right: 0.5rem;
  }
}

.attachment-name, .attachment-send {
  float: left;
  margin: 5px 0 8px 4px;
}
.attachment-name {
  margin-top: 0px;
  width: 160px;
}

.attachment-fileinfo {
  float: left;
  margin: 4px 0 12px 4px;
  a {
    text-decoration: underline;
  }
}

.attachment-fileinfo .large-file {
  color: #ff3344;
}

.add-attachment, .remove-attachment {
  float: left;
}

#custom-prices {
  .label {
    float: left;
    margin-right: 8px;
  }
  .field {
    margin-right: 8px;
  }
  .form-control {
    display: initial;
  }
}
.not-valid {
  text-decoration: line-through;
}
a.info {
  display: inline-block;
  margin-left: 8px;
}

.image-link {
  margin-bottom: 10px;
}

.label.file {
  clear: both;
  margin-top: 10px;
  margin-bottom: 10px;
}

.label.sum, .input.sum {
  text-align: right;
}

.invoice-states {
  float: left;
  margin-right: 20px;
}

.ext-search-buttons {
  text-align: center;
  padding-top: 8px;
  padding-bottom: 8px;
}

.report-settings {
  float: left;
  margin-right: 20px;
}

.list-footer-summary {
  float: right;
}

table.quick-search {
  width: 100%;
}

.settings-list, .report-settings {
  .field, .label {
    .xlarge {
      height: 80px;
      width: 400px;
    }
    .short {
      width: 70px;
    }
    .medium {
      width: 180px;
    }
    .long {
      width: 240px;
    }
    .xlong {
      width: 400px;
    }
  }
}

.settings-list h2 {
  margin-top: 1.5rem;
}

.report-settings, #import_form, #export_form {
  .field, .label {
    float: left;
  }
}

#export_form #columns {
  clear: both;
}

.setup-form {
  padding: 30px 30px 0 30px;

  h1 {
    font-size: 1.6rem;
  }
  h2 {
    font-size: 1.3rem;
  }
}

.setup-group {
  margin-bottom: 3rem;
  &:first-child {
    margin-top: 3rem;
  }
}

.clearfix::after {
  content: "";
  clear: both;
  display: table;
}

.clear-row {
  clear: both;
}

.btn-set:not(.hidden) {
  position: relative;
	display: inline-flex;
  vertical-align: middle;
  margin-bottom: .5rem;

  >.btn:not(:last-child) {
    margin-right: 0.25rem;
  }
}
.btn-set:not(:last-child) {
  margin-right: 0.75rem;
}

#email_form input.form-control {
  width: 240px;
}

.login-form, .profile-form {
  input.form-control {
    width: 160px;
  }
}

.dropdown-item .btn {
  width: 100%;
  text-align: left;
}

@import "table";
