// BACKPORT : while waiting to move to modal bootstrap
@mixin absolute {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
}

@mixin run-transition($property: color, $speed: 250ms, $timing: ease) {
  transition: $property $speed $timing;
}

@mixin lightbox-backdrop {
  position: fixed;
  background: #222;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  box-sizing: border-box;
  opacity: 0.5;
  z-index: 10000;
  display: none;
}

@mixin lightbox-window {
  position: fixed;
  z-index: 10001;
  background: #fff;
  top: 0;
  margin-left: auto;
  margin-right: auto;
  float: none;
  left: 0;
  right: 0;
  display: none;
  border-radius: 5px;
}

section.lightbox-window {
  .row {
    min-height: initial !important;
  }

  .lightbox-buttons {
    position: absolute;
    bottom: 0px;
    width: 100%;

    input[type=submit],
    input[type=button] {
      float: right;
    }
  }
}

.lightbox-buttons {
  position: absolute;
  bottom: 0px;
  right: 0px;
}


section.lightbox,
section.tiny-lightbox {
  color: $text-color;
  font-family: "Arial";
  width: 100%;
  height: 100%;
  overflow: auto;
  position: fixed;
  z-index: 10001;
  top: 0;
  margin-left: auto;
  margin-right: auto;
  float: none;
  left: 0;
  right: 0;
  display: none;
  text-align: left;
  line-height: initial;
  font-size: initial;
  font-weight: normal;
  cursor: default;

  .background {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: 0;
    top: 0;

    &::after {
      content: " ";
      width: 100%;
      height: 100%;
      display: block;
      background: rgba(0, 0, 0, 0.6);
      position: absolute;
      top: 0;
      left: 0;
    }
  }

  h2 {
    color: $primary;
  }

  .close-lightbox {
    position: absolute;
    right: 0;
    top: 0;
    margin: 10px;
    cursor: pointer;

    i.close-2x {
      font-family: "generic-icons";
      font-style: normal;
      font-size: 22px;
      color: $red;

      &::before {
        content: '\e848';
      }
    }
  }

  >div.content {
    border-radius: 5px;
    width: 720px;
    margin-left: auto;
    margin-right: auto;
    background: #fff;
    position: relative;
    margin-top: 20px;
    padding: 15px;
    float: none !important;
    overflow: auto;
    max-height: calc(100vh - 75px);
    z-index: 1;
    max-width: initial;
  }

  .content::after {
    clear: both;
    content: " ";
    display: block;
    width: 100%;
  }

  &::after {
    clear: both;
    content: " ";
    display: block;
    width: 100%;
  }
}

section.tiny-lightbox div.content {
  width: 500px;
}

.lightbox-view,
.lightbox {
  .tabs.linker {
    section .icons-view {
      border-left: 0;
    }

    select {
      height: 25px;
    }
  }

  .linker {
    input[type=checkbox] {
      margin-left: 0;
    }

    input[type=text],
    select,
    label {
      margin: 5px;
      margin-left: 0;
      margin-right: 0;
    }

    .found-resources {
      position: relative;
      height: 165px;
      overflow-y: auto;
      clear: both;
      @include run-transition(height);

      .icons-view {
        overflow: auto;
        @include absolute;
      }
    }

    .illustrated-list {
      position: absolute;

      li {
        img {
          position: relative !important;
          height: 100% !important;
        }
      }
    }
  }

  .search-pagination {
    input {
      padding-right: 45px !important;
      padding-left: 45px !important;
      margin: 0 !important;
      box-sizing: border-box;
    }

    .show-close {
      position: absolute;
    }
  }
}

// Theme 1D

.lightbox-window,
.lightbox>.content {
  padding: 10px;
  box-shadow: 2px 2px 24px $shadow;
  background: $white;

  h2,
  h2:first-child {
    font-size: 20px;
    font-weight: normal;
    margin-bottom: 10px;
  }

  nav.vertical {
    margin-right: 0;

    li {
      padding-left: 10px;
    }

    >ul>li,
    >div>ul>li {
      padding-left: 0;
    }
  }

  .tabs {
    margin-top: 10px;

    section {
      padding: 15px 0px;
      border: none;
      border-top: 1px solid $gray-600;
      background: $white;
    }

    header.selected {
      background: transparent;
    }
  }
}


.lightbox-opened {
  header.main {
    opacity: 0;
    pointer-events: none;
  }
}

.lightbox form#changePassword {
  label {
    display: block;
  }
}


section.lightbox-window {
  form#upload-form {
    h3 {
      width: auto;
      float: none;
    }

    .hidden-content {
      float: left;
    }

    button,
    .right-magnet input {
      margin-bottom: 5px;
    }
  }
}

.lightbox-window .datepicker,
.lightbox-view .datepicker,
.lightbox .datepicker {
  z-index: 1100;
}

.lightbox-view {
  @include lightbox-window();

  section.lightbox-window {
    .row {
      min-height: initial !important;
    }

    .lightbox-buttons {
      position: absolute;
      bottom: 0px;
      width: 100%;

      input[type=submit],
      input[type=button] {
        float: right;
      }
    }
  }

  .lightbox-buttons {
    position: absolute;
    bottom: 0px;
    right: 0px;
  }


  section.lightbox,
  section.tiny-lightbox {
    width: 100%;
    height: 100%;
    overflow: auto;
    position: fixed;
    z-index: 10001;
    top: 0;
    margin-left: auto;
    margin-right: auto;
    float: none;
    left: 0;
    right: 0;
    display: none;
    text-align: left;
    line-height: initial;
    font-size: initial;
    font-weight: normal;
    cursor: default;

    .background {
      position: fixed;
      width: 100%;
      height: 100%;
      z-index: 0;
      top: 0;

      &::after {
        content: " ";
        width: 100%;
        height: 100%;
        display: block;
        background: rgba(0, 0, 0, 0.6);
        position: absolute;
        top: 0;
        left: 0;
      }
    }

    >div.content {
      border-radius: 5px;
      width: 720px;
      margin-left: auto;
      margin-right: auto;
      background: #fff;
      position: relative;
      margin-top: 20px;
      padding: 15px;
      float: none !important;
      overflow: auto;
      max-height: calc(100vh - 75px);
      z-index: 1;
      max-width: initial;
    }

    .content::after {
      clear: both;
      content: " ";
      display: block;
      width: 100%;
    }

    &::after {
      clear: both;
      content: " ";
      display: block;
      width: 100%;
    }
  }

  section.tiny-lightbox div.content {
    width: 500px;
  }

  .lightbox-view,
  .lightbox {
    .tabs.linker {
      section .icons-view {
        border-left: 0;
      }

      select {
        height: 25px;
      }
    }

    .linker {
      input[type=checkbox] {
        margin-left: 0;
      }

      input[type=text],
      select,
      label {
        margin: 5px;
        margin-left: 0;
        margin-right: 0;
      }

      .found-resources {
        position: relative;
        height: 165px;
        overflow-y: auto;
        clear: both;
        @include run-transition(height);

        .icons-view {
          overflow: auto;
          @include absolute;
        }
      }

      .illustrated-list {
        position: absolute;

        li {
          img {
            position: relative !important;
            height: 100% !important;
          }
        }
      }
    }

    .search-pagination {
      input {
        padding-right: 45px !important;
        padding-left: 45px !important;
        margin: 0 !important;
        box-sizing: border-box;
      }

      .show-close {
        position: absolute;
      }
    }
  }

  ;
}

.lightbox-background {
  @include lightbox-backdrop;
}

.media section.lightbox {
  cursor: default;
}


.lightbox form {
  .fill-bar {
    margin-top: 12px;
  }

  p.input-errors {
    margin-bottom: 30px;
  }
}


.lightbox-view .linker .found-resources,
.lightbox .linker .found-resources {
  height: 200px;
}

//changePassword lightbox
section.lightbox>.background+div.content>.twelve.cell {
  >.twelve.cell {
    float: none;
  }
}

.lightbox form#changePassword {
  height: auto;

  >.twelve.cell.fluid {
    height: auto;
  }
}

.lightbox>.background::before {
  content: " ";
  display: block;
  height: 100vh;
  background: transparent;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: url(../../img/illustrations/logo.png) 23px 0px no-repeat $shadow;
  background-size: contain;
  box-shadow: 0 2px 5px $shadow;
}

.lightbox-view {
  @include lightbox-window;
  width: 800px;
  text-align: left;
}

.lightbox-background {
  @include lightbox-backdrop;
}

body.lightbox-body {
  background: #666;

  header.lightbox-header {
    opacity: 0.3;
  }

  section.lightbox-main {
    background: rgba(255, 255, 255, 0.3)
  }
}

@include media-breakpoint-down(md) {
  body {
    section.lightbox {
      >div.content {
        padding: 20px;
        min-height: calc(100% - 50px);
        width: calc(100% - 50px);
        margin: 25px;
        border-radius: 0;
        box-sizing: border-box;
      }
    }
  }
}