
// Helpers
// -------------------------------

// ngAnimate
//@import "helpers/animate";
// Fade in typekit
//@import "helpers/typekit";

@mixin ellipsis() {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  display: block;
}

*
{
  box-sizing: border-box;
}

.modal-backdrop {
   position: fixed !important;
   top: 0px;
   left: 0px;
   height:100%;
   width:100%;
   background: #000;
   z-index: 10999 !important;
   opacity: 0.5;
}

.modal-holder {
  position: fixed;
  top: 50%;
  left: 50%;
  height: $modal-height+40px;
  width: $modal-width+80px;
  margin-top: -($modal-height+40px)/2;
  margin-left: -($modal-width+80px)/2;
  background: transparent;
  z-index: 11000;
  padding: 30px 15px;

  .modal-box {
    margin: 0 auto;
    width: 100%;
    background: #fff;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 1px 2px 5px rgba(0,0,0,0.3);
    position: relative;
  }
}


@media screen and (min-width: 992px)
{
  .modal-box {
    width: 50%;
    padding: 30px;
  }
}


// Set up spinnining icons

@include keyframes(spin) {
  from {
    @include transform(rotate(0deg));
  }
  to {
    @include transform(rotate(360deg));
  }
}

.angular-media-field {

  .thumbnails {
    display: inline;
    //margin-left: -10px;
  }

  .thumbnail,
  .placeholder-thumbnail {
    position: relative;

    .btn-action {
      display: none;
      top: 10px;
      position: absolute;

      &.thumbnail-edit {
        left: 10px;
      }
      &.thumbnail-remove {
        right: 10px;
      }
    }

    &:hover .btn-action {
      display: block;
    }
  }

  .thumbnail {
    width: 110px;
    height: 140px;
    margin: 5px;
    float: left;

    &.active {
      border-color: #E9D24F;
      background-color: #E9D24F;
    }

    img {
      max-width: 100%;
      max-height: 100px;
      height: auto;
      margin: 0 auto;
    }

    .thumbnail-title {
      @include ellipsis;
      font-size: .9em;
      padding-top: 5px;
    }

    .download-icon {
      font-size: 15px;
      color: #ccc;
    }

    .or {
      margin: .5em 0 !important;
    }

    .btn.media-select {
      display: block;
      position: relative;
      margin: 0 auto;
    }

  }

  .clearfix {
    clear: both;
  }

}

.placeholder-thumbnail {
  min-height: 350px;
  background-color: #eee !important;
  border: none !important;
  text-align: center;
  font-size: 1.5em;
  display: none;

  &.visible {
    display: block;
  }

  .upload-text {
    margin-top: 100px;
  }

  img {
    max-width: 100%;
    height: auto;
    max-height: 500px;
    margin: 0 auto;
    width: auto;
  }
}

.thumbnail-icon {
  text-align: center;
  position: relative;
  width: 100px;

  &.icon-lg {
    width: 100%;
  }

  img {
    max-width: 100%;
    height: auto;
  }

  .file-icon {
    font-size: 100px;
    color: #ccc;
  }
  .file-icon-text {
    text-transform: uppercase;
    color: #fff;
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100px;
    font-size: 20px;
    font-weight: bold;
  }

  &.icon-lg {
    .file-icon {
      font-size: 180px;
    }
    .file-icon-text {
      width: 180px;
    }
  }
}

.drop-zone,
.thumbnail.drop-zone {
  border: 2px dashed #ccc;
  padding: 10px;
  text-align: center;
  position: relative;
  background-color: rgba(#eeeeee, 0);

  .or {
    font-size: .8em;
    text-transform: uppercase;
    margin: 2em 0;
  }

  .drop-label {
    font-size: 1.3em;
    font-weight: bold;
  }

  .file-upload {
    margin: 0 auto;
  }

  .description {
    color: #aaa;
    font-size: .9em;
    text-align: left;
    width: 85%;
    margin: 5px auto;
  }

  &,
  & > *{
    @include transition(background ease-out .1s)
  }
  
  & > * {
    opacity: 1;
  }

  &.upload-active {
    background-color: rgba(#eeeeee, 1);

    $spinner-dim: 30px;

    & > * { 
      opacity: 0.5;
    }

    &:before {
      content: "\e031";
      display: inline-block;
      font-family: 'Glyphicons Halflings';
      font-style: normal;
      font-weight: 400;
      -webkit-font-smoothing: antialiased;
      position: absolute;
      top: 50%;
      margin-top: -($spinner-dim/2);
      left: 50%;
      margin-left: -($spinner-dim/2);
      text-align: center;
      width: $spinner-dim;
      height: $spinner-dim;
      line-height: $spinner-dim;
      font-size: $spinner-dim - 2;
      @include animation(spin 2s infinite linear);
      @include transform-origin(($spinner-dim/2) ($spinner-dim/2 - 1));
      z-index: 1;
    }
  }
}

/*
  form {
    width: $modal-width;
    height: $modal-height;
    position: relative;

    select {
      max-width: 200px;
    }
  }
*/


.modal-box {

  .modal-close {
    color: #ccc;
    right: 10px;
    position: absolute;
    z-index: 1010;
  }

  .preview {
    position: relative;
    display: block;
    max-width: 200px;

    .preview-overlay {
      top: 20px;
      position: absolute;
      display: none;
      width: 100%;
      text-align: center;
    }

    &.croppable {
      cursor: pointer;

      &:hover {
        img {
          opacity: .5;
        }

        .preview-overlay {
          display: block;
        }
      }
    }
    
  }

  .edit-form {
    .editable-item {
      height: auto;
      padding: 5px 0;
    }

    .title {
      display: inline-block;
      font-weight: bold;
      padding-top: 5px;
      vertical-align: top;
      min-width: 90px;
    }

    .editable {
      display: inline-block;
      padding-top: 5px;
      vertical-align: top;
    }

    .editable-form {
      margin-left: 10px;
    }
    
  }

  .image-crop {
    max-width: 500px;

    .ng-jcrop {
      padding-bottom: 40px;

      img.ng-jcrop-image {
        max-width: 100% !important;
        max-height: 500px !important;
        height: auto !important;
        margin: 0 auto;
      }
    }
  }


  .filters,
  .browser {
    margin-top: 10px;
  }

  .browser {
    position: relative;

    .scroll-wrapper {
      width: $modal-width;
      height: $modal-height;
      overflow-y: scroll;
      ms-overflow-x: hidden;  
    }

    .left,
    .scroll-wrapper.active {
      width: $modal-width - $modal-sidebar-width - 10px;
    }

    .thumbnail {
      cursor: pointer;
    }

    .sidebar {
      width: $modal-sidebar-width;
      height: 100%;
      position: absolute;
      right: 0;
      top: 0;
      background: white;

      h3,
      h5 {
        margin: 0;
      }

      .preview {
        text-align: center;

        img {
          max-height: 200px;
          margin: 0 auto;
        }
      }
    }

    &.upload {

      .queue {
        margin-top: 5px;
        height: 185px;
        overflow-y: auto;
        margin-left: -30px;

        .queue-item {
          padding: 7px 5px 7px 30px;
          cursor: pointer;

          &.active {
            background-color: #F5F5F5;
          }

          .file-thumb {
            float: right;
            margin-left: 5px;
          }

          .file-name {
            @include ellipsis;
            font-weight: bold;
          }

          .file-size {
            float: left;
            margin-right: 5px;
          }

          .progress {
            margin: 3px 5px;
            height: 12px;
          }
        }
      }

      .file-details {
        background-color: #F5F5F5;
        padding: 10px;
        border-radius: 3px;
        min-height: 300px;
      }
    }
  }


  .bottom-left,
  .bottom-right {
    position: absolute;
    bottom: 10px;

    &.bottom-left {
      left: 10px;
    }

    &.bottom-right {
      right: 10px;
    }  
  }

}



/* Hack to fix issue with how item is added to page via fapi */
.field-widget-file-angular-media {
  margin-bottom: 2em;

  .form-item {
    margin-bottom: 0;
  }
}